Can you call a Javascript function that expects let’s say five arguments, and supply let’s say the first three, and the fifth, but I want the fourth argument to be absent, i.e. null or undefined. The form of this I’d like to use would be: myfunction(1,2,3,,5);
I can’t figure out if the “double commas” with nothing between them can pass thru as “null” or something like that, yet the fifth argument passes without a problem.
You can call myfunction(1,2,3) and if the function expects #4 and #5 these appear as undefined or typeof undefined, just fine. It’s an omitted one in the middle I’m having trouble with.
Thank you, stackoverflow fans!
P.s. myfunction(1,2,3,null,5); seems to work but that seems kind of hokey, how about just the paired commas?
Try it.
So no, you can’t just do the double comma.