let n = [1, 2, 3, 4, 5]
function modifyArray(nums)
{
let arr = []
nums.forEach((ele,index)=>{
if(ele % 2 == 0){
arr.push(ele*2)
}
else{
arr.push(ele *3)
}
})
return arr
}
// console.log(arr);
console.log(modifyArray(n))
0 Comments