This content originally appeared on DEV Community and was authored by DEV Community
So me and my peer discovered in our boot camp lab today that If you use the .splice() method on an array and want to use it to make a copy with an additional element at the end of the array ( exp. Arr.splice(start, deletecount, new element added).)
You kind of have to know the length of the array because it adds the new element to the left indexs of the specified starting point so .splice(-1,0,”newstring”)will add the new string an index before the final element in the array and not at the end of the array. Wild, just wild. Any comments to expand my understanding of this method is more than welcome.
This content originally appeared on DEV Community and was authored by DEV Community

DEV Community | Sciencx (2022-03-01T06:22:10+00:00) Well splice seems interesting. Retrieved from https://www.scien.cx/2022/03/01/well-splice-seems-interesting/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.