(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-48897844-1', 'jennifermadden.com'); ga('send', 'pageview');
function favoriteNumber(myArg) {// 1. declareIn the above example, the value of myArg is "One" when the first call to the function is made. When the second call to the function is made, the value of myArg is "Two". If I didn't use an argument here, there would have to have been 2 functions written for each value.
alert(myArg) // 2. used here
}
<input type="button" onclick="favoriteNumber('One')"> <!-- 3. assign value -->
<input type="button" onclick="favoriteNumber('Two')"> <!-- 3. assign value -->
function passStuff(myArg1,myArg2,myArg3) {Just for fun, try another example.
alert(myArg1 + myArg2 + myArg3)
}
<a href="javascript:passStuff('One','Two','Three')">One, Two, Three</a>
<a href="javascript:passStuff('Uno','Dos','Tres')">Uno, Dos, Tres</a>
function changeBackground(myColor) {
document.bgColor = myColor // bgColor is a property of the document object
}