I was wondering, can you create a function with an optional parameter.
Example:
function parameterTest(test) { if exists(test) { alert(\'t
null == undefined is true
null == undefined
if (arg == null){ // arg was not passed. }
Code example:
var button = document.querySelector("button"); function myFunction(arg){ if(arg == null){ alert("argument was not passed."); } else { alert("argument " + arg + " was passed."); } }
click to fire function w arg click to fire function w/o arg