Please enable JavaScript.
Coggle requires JavaScript to display documents.
Arrays (Adding and Removing Elements (Destructive) (Array.prototype…
Arrays
-
-
Holes in Arrays
-
Which Operations Ignore Holes,
and Which Consider Them?
forEach() skips holes:
['a',, 'b'].forEach(function (x,i) { console.log(i+'.'+x) })
-
map() skips, but preserves holes:
['a',, 'b'].map(function (x,i) { return i+'.'+x })
-
join() converts holes, undefined s, and null s to empty strings:
['a',, 'b'].join('-')
'a--b'
-
The for-in loop
for (var key in ['a',, 'b']) { console.log(key) }
0
2
-
-
-
-
Overview
Arrays Are Maps, Not Tuples
-
-
-