Generation

generate functionSat, 12 Nov 2022

return increase or decrease arrays number

let arr = [1,2,3,4] function increase(arr){ newArr = [] for(let i=0; i<arr.length; i++){ newArr.push(arr[i]+1) } return newArr } function decrease(arr){ newArr = [] for(let i=0; i<arr.length; i++){ newArr.push(arr[i]-1) } return newArr }

Javascript
Generate More

Questions about programming?Chat with your personal AI assistant