How to pass the value 'undefined' to a function with multiple parameters?
myFunction(undefined,"abc");
this way should work, what is the problem?
see here
Here is undefined documentation from mozilla, supported by all browsers
The void
operator seems to be the most common way to explicitly get undefined
.
You would use it like this in your example:
myFunction(void 0, "abc");
It's also a reliable method for comparing against undefined
that is guarded against undefined
being accidentally overridden in older JavaScript environments:
var x;
if (x === void 0) {
// this will execute
}