O'Reilly logo
  • Noach Magedman thinks this is interesting:

console.log(colors[1]);             // "green"

From

Cover of Understanding ECMAScript 6

Note

Setting colors.length = 2 actually deletes elements 2 and 3; it doesn't just mask them. To make this point clear, extend this code snippet with:

colors[4] = "white" console.log(colors[4]); // "white" console.log(colors[3]); // undefined console.log(colors[2]); // undefined console.log(colors[1]); // "green"