Question #278886

Series of Operations


Given an array myArray of numbers, write a JS program to perform the following steps and log the result.


1. Multiply each value with 9.


2. Subtract 20 from each value.


3. Multiply each value with 7.


4. Log the values of the resulting array separated by a


Expert's answer

let arr = [];
for (let i = 0; i < arr.length; i++) {
   arr[i] *= 9;
   arr[i] -= 20;
   arr[i] *= 7;
   console.log(arr[i]);
}
LATEST TUTORIALS
APPROVED BY CLIENTS