Javascript Array range(from, to)
"use strict";/* w w w .jav a 2 s . c om*/ Array.prototype.range = function(from, to) { var i = from, result = []; while(i <= to) { result.push(i); i++; } return result; };
Array.prototype.range = function(from, to){ var arr = [];/*from w w w . jav a2s . co m*/ while(from < to + 1){ arr.push(from); from++; } return arr; };
Array.prototype.range = function(from, to) { var result = [] while (from <= to) result.push(from++)//from w ww. j a va 2 s.c o m return result }
"use strict";//from w w w . j a v a 2s . c o m Array.prototype.range = function(from, to) { var result = []; while(from <= to) { result.push(from); from = from + 1; } return result; };
Array.prototype.range = function(from, to) { var i, result = []; for (i = from; i<= to; i++) { result.push(i);/*from w w w . j av a 2 s .c om*/ } return result; }; console.log([].range(1, 10));