paint-brush
How to Insert an Item Into an Array at a Specific Index in Javascriptby@smpnjn
226 reads

How to Insert an Item Into an Array at a Specific Index in Javascript

by Johnny Simpson2mSeptember 19th, 2022
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Arrays are common data structures found in Javascript. They act a lot like arrays found in other languages, and are relatively easy to define. Sometimes we want to insert a new item into an array at a specific point. This is known as inserting an item into a specific index. In Javascript, this turns out to be quite an easy operation to perform. We use the 'splice' method, which is a simple function that takes 3 arguments - which also lets us delete items too.
featured image - How to Insert an Item Into an Array at a Specific Index in Javascript
Johnny Simpson HackerNoon profile picture
Johnny Simpson

Johnny Simpson

@smpnjn

Product, Engineering, Web

About @smpnjn
LEARN MORE ABOUT @SMPNJN'S
EXPERTISE AND PLACE ON THE INTERNET.
L O A D I N G
. . . comments & more!

About Author

Johnny Simpson HackerNoon profile picture
Johnny Simpson@smpnjn
Product, Engineering, Web

TOPICS

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite