Sovi.AI - AI Math Tutor

Scan to solve math questions

QUESTION IMAGE

remove the last element, then add a 7 to the end of the array. do not o…

Question

remove the last element, then add a 7 to the end of the array. do not output to the console. let userarray = 4, 2, 8, 5, 0, 1, 6; // tests may use different array values / your solution goes here /

Explanation:

Step1: Remove the last element

userArray.pop();

Step2: Add 7 to the end

userArray.push(7);

Answer:

The code should be userArray.pop(); userArray.push(7);