how can i detect if JS parameters have extra text? <p>If I have a function with parameters (or argument) like this:</p> <pre><code>check('red', 'blue', 'arial') </code></pre> <p>What i would like to know is can you have text like this:</p> <pre><code>check(background:'red', color:'blue', font:'arial') </code></pre> <p>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:</p> <pre><code> function check(one, two, three){ if (one==background:one){ document.body.style.background= one ; } } </code></pre> <p>I know this doesn't work, how would you do this or something like it?</p> <p>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.</p>