Here is the simplest version using your original line of thoughts
Implementing a range function can be more complex than this, but since this works, I suggest it for now
function buildArray(a, b) {
var arr = [];
for (var i = a; i <= b; i++) {
arr.push(i);
}
return arr;
}
console.log(buildArray(5, 10));
3
solved How to convert function parameters into an Array?