Don’t know why my shift/unshift code does not work

Tell us what’s happening:

I can’t get my code to pass. Can anyone tell me why not?

Your code so far


function mixedNumbers(arr) {
// Only change code below this line
arr.unshift('three');
arr.unshift(2);
arr.unshift('I');
arr.push('7');
arr.push('VIII');
arr.push(9);

// Only change code above this line
return arr;
}

console.log(mixedNumbers(['IV', 5, 'six']));

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Safari/605.1.15.

Challenge: Add Items to an Array with push() and unshift()

Link to the challenge:

Hi, dear you are so close the solve problem. why have you repeated the push() and unshift() method. play like arr.push(1,…) or unshift(3, 4, 5)

Hi there,
Your code should work, but you are pushing '7' into the array when you should be pushing 7. '7' is a string, and they want a number.

As @MM-HASAN said, there’s no need to push and unshift each element individually. You can push or unshift multiple items at once like so:

arr.push(1, 2, 3)
arr.unshift(4, 5, 6)

Hope this helps.