DEV Community

Discussion on: JSByte: JavaScript Array Slice vs Splice: the Difference Explained with Cake

Collapse
 
rouilj profile image
John P. Rouillard

Shouldn't:

let myPieceOfCake = infiniteCake.slice(0)

make myPieceOfCake an array of 6 pieces of cake. Since end is omitted, it should copy to the end of the infiniteCake array.

(Also you misspelled infinite in at least one place.)

Now for the important point, what type of cake is it?

Collapse
 
shrutikapoor08 profile image
Shruti Kapoor

"Look Ma I am making ~tyops~! "
Thanks for bringing it to my attention! :) I have fixed the code - let myPieceOfCake = infiniteCake.slice(0,1)
It is a mango mousse cake! 🍰🥭