function range(a,b,c) { var arr = []; c = c == undefined?1:c; for (var i = a; a<b?i<= b:i>= b; i += c) arr.push(i); console.log(arr); }