I am trying to create a function with parameters. I believe that I have to use objects, but so far have failed. By options, I mean something like this:
insertButton({ settings:{ value1:'Some text' } }); function insertButton(settings){ settings = new Object(); document.write(settings.value1); }
Obviously this will not work, but I'm trying to show what I mean. Maybe someone can help.
I ask because now I have a simple function where I can pass values ββin strict order. With options, I want to be independent of the order of the variables in the function. For instance:
function insertButton2(value1,value2,value3){ document.write(value1); document.write(value2); document.write(value3); } insertButton2('a','','c');
Leaving empty commas to make sure that the "c" value3 is not convenient for me. That is why I would like to try objects, parameters.
thanks.
source share