Tell us what’s happening:
I am using the spread operator here with the push and unshift method and the return is: [“I”, 2, “three”, “IV”, 5, “six”, 7, “VIII”, 9].
But somehow I can’t pass the “utilize the push()
method” & “utilize the unshift()
method”.
Your code so far
function mixedNumbers(arr) {
// change code below this line
let front = ['I', 2, 'three'];
let end = [7, 'VIII', 9];
arr.unshift(...front);
arr.push(...end);
// change code above this line
return arr;
}
// do not change code below this line
console.log(mixedNumbers(['IV', 5, 'six']));
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-data-structures/add-items-to-an-array-with-push-and-unshift