1. Home
  2. Javascript
  3. Push
#javascript#array

Use push method to append a new item to the end of an array.

var colors = ["red","green","blue"];
colors.push("yellow");
// ["red","green","blue","yellow"]
copy
Full Javascript cheatsheet
Sitemap Git repository