Javascript - Adding Elements (push, unshift)
📖 Read the lesson
Code Life
By Pierre Marsaa
Adding at the End: push
You caught a new Codémon! To add it at the end of the team, use the
push()
method:
↗️
Loading editor...
↶
▶️ Run
↷
No index to compute, no risk of holes:
push
always appends right after the last element, and
length
is updated automatically.
Verify