Popping and unshifting

Report a typo

Write a changeArray function that removes one element from the end of myArray and adds the element passed as function parameters to the beginning of myArray. After all the operations, the changeArray function should return the changed array myArray (we recommend using the pop() and unshift() array methods)

Write a program in JavaScript
function changeArray(x){
const myArray = ['John', 'Kate', 'Igor', 'Sam', 'Stan', 'William'];
// write your code here

}
___

Create a free account to access the full topic