Splice vs Slice!
the most confusing method of javascript which can be understood easily. Hope this helps ⤵️
slice: copies array then operates
splice: doesnt copy array
slice is like you're creating multiple slices of 1 apple and splice I like you are making slices of apples itself
Let xArray = [1,9,9,2] Let yFuntion = (array) =>{ //slice the array } yFuntion(xArray) Console.dir(xArray) : no effect //========= Let zFuntion = (array) =>{ //"splice" the array } zFuntion(xArray) Console.dir(xArray) : affected
Any other shortcut stuff you use for remembering these kind of method, share with us 🤝👌
Top comments (1)
❤️💙