In general, this is a kind of gray area ... what do you mean by "matters"? The null and undefined values ββare valid values ββthat you can assign to a variable ...
The String split() function always returns an array, so use the length property of the result to find out which indexes are present. Out-of-range metrics will be undefined .
But technically (outside the context of String.split() ) you can do this:
js>z = ['a','b','c',undefined,null,1,2,3] a,b,c,,,1,2,3 js>typeof z[3] undefined js>z[3] === undefined true js>z[3] === null false js>typeof z[4] object js>z[4] === undefined false js>z[4] === null true
source share