Problem Statement
Get the integers within a range (x, y)
input: (2,9)
output: [3,4,5,6,7,8]
var range = function(x, y) {
// start here
};
Solution
var range = function (x, y) {
if (y === x + 1) return [x];
return [x].concat(range(x + 1, y));
};
Top comments (0)