What is the best way to test if a javascript variable is passed a value into a function
function test(a, b) { /* check if b was given a value */ }
I want to say
if(!b)
but this doesn't work if b = 0. Do I have to individually check if it is undefined or null like
if(typeof(b) === 'undefined' || b === null)
or is there a better way to write this?