If I have a function with parameters (or argument) like this:
check('red', 'blue', 'arial')
What i would like to know is can you have text like this:
check(background:'red', color:'blue', font:'arial')
In the function I have a if statement so if the parameter or argument has background: before it, it changes the background to the parameter after the background:
function check(one, two, three){
if (one==background:one){
document.body.style.background= one ;
}
}
I know this doesn't work, how would you do this or something like it?
Can I use a if statement but code it to detect if a parameter has 'background:' before it? Is this possible or is there a better way of doing it? I would like to use pure JavaScript if that is possible.