Js function with parameters

Hello!
How can I make a button increase date by 1?
It should work for red and green simultaneously.

Can I do a function in funk?
And how do I access it whitout id?

function funk(id){
const date = new Date();

if(id=1){ show date in red, in div a}
if(id=2){ show date in green, in div b }
}

I simplified the code, funk is working with multiple id’s.

  • please code between [ code ] [ /code [ tags

  • increase by ‘1’…what? second? minute? day? month? year?

  • red & green… what? buttons?

  • what is ‘funk’?

  • provide the layout/DOM for this DIV a and DIV b

increase by 1, is what it says, increase the date by 1.
the color is just to show that the function does different things when the function is called with different id’s.
funk is just the name on the function, it could be anything.

Sponsor our Newsletter | Privacy Policy | Terms of Service