• + 0 comments
    const modifyArray = (nums) => {
        return nums.map((num)=>{return (num%2 === 0)?(num*2):(num*3)})
    }
    

    this is the simpliest way to do it , where map() creates a new array from calling a function for every array element and does not change the original array. then just return the new array for modifyArray function.