null means that something exists, but it has been said that it does not matter. undefined means that the item has not received a value, usually because it has not been declared / initialized.
In Javascript, undefined is primitive. It is false, so it evaluates to False if used in a conditional expression.
Javascript is not a strongly typed language, so there is nothing to verify that a callback function is a function before it is called. In fact, Javascript does not care about how many arguments are passed or what their type is, everything is simply reset when the function is called, and it depends on the argument processing function.
For example, in many enumerated methods, they come back to you (index, value, array) . It doesn't matter if your function searches for these values ββor assigns them a temporary variable, they are still passed. Both a.forEach(function(index){}) and a.forEach(function(){}) really have access to all 3 mentioned variables.
source share