What's the output?
const fruit = ['๐', '๐', '๐']
fruit.slice(0, 1)
fruit.splice(0, 1)
fruit.unshift('๐')
console.log(fruit)You missed this one before
First, we invoke the slice method on the fruit array. The slice method does not modify the original array, but returns the value that it sliced off the array: the banana emoji.
Then, we invoke the splice method on the fruit array. The splice method does modify the original array, which means that the fruit array now consists of ['๐', '๐'].
At last, we invoke the unshift method on the fruit array, which modifies the original array by adding the provided value, โ๐โ in this case, as the first element in the array. The fruit array now consists of ['๐', '๐', '๐'].
Question 149 ยท see the original (opens in a new tab)
or press Enter