I have a little problem with my Javascript code. Here is my question :
I want to write a function, who take in input a table of numbers. If numbers situated in even index, be returned as the way it is. But, if numbers situated in odd index, be return multiplied by his index.
For example :
Input :
[5, 10, 15, 20, 25, 30, 50, 100]
Return :
[5, 10, 15, 60, 25, 150, 50, 700]
So, my code :
function multiplyNum(numbers) {
const multiply = numbers.map(function(number) {
for (let i = 0; i < numbers.length; i++) {
if (numbers[i] % 2 == 0) {
return numbers
}
if (numbers[i] % 2 !== 0) {
return numbers
}
});
return multiplyNum
}