Well splice seems interesting

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…


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


Print Share Comment Cite Upload Translate Updates
APA

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/

MLA
" » Well splice seems interesting." DEV Community | Sciencx - Tuesday March 1, 2022, https://www.scien.cx/2022/03/01/well-splice-seems-interesting/
HARVARD
DEV Community | Sciencx Tuesday March 1, 2022 » Well splice seems interesting., viewed ,<https://www.scien.cx/2022/03/01/well-splice-seems-interesting/>
VANCOUVER
DEV Community | Sciencx - » Well splice seems interesting. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/03/01/well-splice-seems-interesting/
CHICAGO
" » Well splice seems interesting." DEV Community | Sciencx - Accessed . https://www.scien.cx/2022/03/01/well-splice-seems-interesting/
IEEE
" » Well splice seems interesting." DEV Community | Sciencx [Online]. Available: https://www.scien.cx/2022/03/01/well-splice-seems-interesting/. [Accessed: ]
rf:citation
» Well splice seems interesting | DEV Community | Sciencx | 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.

You must be logged in to translate posts. Please log in or register.