[TOC]
Using block
, proc
, lambda
or shorthand
for devleoping easily. We don't need to code so many words and coding style is elegant.
We're often using the simplest way to code a map
lambda method. A well-known example:
In Javascript to create an array of number from 0 to n-1, we can use spread operator. It is part of ECMAScript (version 6). Currently IE does not have good support for it. It can be used in node scripts safely though.
We can use array of empty values and keys function. Note that Array(10) generates array of empty values of size 10.
var arr = [...Array(10).keys()]