is that possible to call Javascript function without supply all the parameters?
I come across a line of code doesn’t make much sense unless I assume that in Javascript supply all the parameters are not required?
The parameter been missed is a boolean value, so could I further assume that undefined boolean value in Javascript equal to ‘false’?
Yes, the other parameters will just be
undefinedif they’re not passed in 🙂For example:
This is a valid call:
Give it a try here. If the check in your question is something like
if(!param2), it’ll evaluate totrue, sinceundefined ~= falsefor most purposes. It’s worth noting this is not only acceptable, it’s very common, almost every library or framework expects only some of the parameters to be passed into most of their functions.