I have now seen 2 methods for determining if an argument has been passed to a JavaScript function. I\'m wondering if one method is better than the other or if one is just ba
In ES6 (ES2015) you can use Default parameters
function Test(arg1 = 'Hello', arg2 = 'World!'){ alert(arg1 + ' ' +arg2); } Test('Hello', 'World!'); // Hello World! Test('Hello'); // Hello World! Test(); // Hello World!