Skip to content

Latest commit

 

History

History
28 lines (23 loc) · 543 Bytes

04-arrays.md

File metadata and controls

28 lines (23 loc) · 543 Bytes

Chapter 5 - Arrays

Arrays

Credits: illustration by unDraw

1. What's Array(k) really doing?

Example:

var a = Array( 3 );
a; // []
a[2];  // undefined
a.length; // 3
a.map( (v,idx)=>idx ); // [ ]

var b = Array.apply( null, Array(3) );
b; // [undefined,undefined,undefined]
b[2];   // undefined
b.length; // 3
b.map( (v,idx)=>idx ); // [0,1,2]

TODO: explanation