Can someone please explain to me why my code below is not passing? The reason it gives is “Must return an array”. It is though, isn’t it?
function double(arr) {
for (let i=0; i<0; i++) {
let arr2 = [];
arr2.push(arr[i] * 2);
return arr2;
}
}
let arr1 = [1, 2, 3];
let arrDouble = double(arr1);
Type your question above this line.
Course: https://www.educative.io/collection/5679346740101120/5720605454237696
Lesson: https://www.educative.io/collection/page/5679346740101120/5720605454237696/5647906690301952