My function is taking in 2 integer parameters and returning the numbers between those two parameters. I cannot convert the numbers shown into an array.
As I'm supposed to buildArray function that takes two Numbers, and returns an Array filled with all numbers between the given number: buildArray(5, 10) should return [5, 6, 7, 8, 9, 10].
I have tried using split to convert the values into an array but I've failed many times.
My code prints each value separately whereas i need the values to be displayed in an array.
function buildArray(a, b) {
for (var i = 0; i <= b; i++) {
i = a;
console.log(a);
a = a + 1;
}
}
console.log(buildArray(5, 10));