range with steps js code example Example 1: range javascript [...Array(5).keys()]; => [0, 1, 2, 3, 4] Example 2: range in javascript See below link