• + 0 comments

    In JS

    function modifyArray(nums) {
        const res = nums.map((val) => {
      if (val % 2 == 0) {
        return val * 2;
      } else {
        return val * 3;
      }
    });
    
    return res;
    
    }