You are viewing a single comment's thread. Return to all comments →
Basic level of coding style
function modifyArray(nums) { // nums.sort() let arr1 = [] for(let i = 0; i <= nums.length ; i++ ){ if( nums[i]%2 == 0 ){ arr1.push(nums[i]*2) // console.log("even: ",nums[i]) } else{ arr1.push(nums[i]*3) // console.log("odd: ",nums[i]) } } // console.log(arr1) for(let j = 0; j <= arr1.length; j++ ){ if(arr1[j] == undefined){ arr1.pop(arr1[j]) } } // console.log(arr1) return arr1 }
Seems like cookies are disabled on this browser, please enable them to open this website
Day 5: Arrow Functions
You are viewing a single comment's thread. Return to all comments →
Basic level of coding style