+ 2

Is there a JS code with the same result of Python’s range()?

Is it possible to have a function working like those Python lines in JavaScript? a = 5 b = 20 c = 2 all = list(range(a, b, c)) print(all)

13th Nov 2017, 4:34 PM
àŒșBluxtydàŒ»
àŒșBluxtydàŒ» - avatar
1 Answer
+ 1
var a = 5; var b = 20; var c = 2; var all = []; for (var i = a; i<=b; i+=c){ all.push(i); } alert(all);
13th Nov 2017, 5:22 PM
Witty Phantom
Witty Phantom - avatar