Array.prototype.push()
Add items to an array. Pass the new items in as arguments.
let sandwiches = ['turkey', 'tuna', 'blt'];
sandwiches.push('chicken', 'pb&j');
// logs ["turkey", "tuna", "blt", "chicken", "pb&j"]
console.log(sandwiches);
⏰ Preorder my new course on Web Components! Want to learn how to build Web Components from scratch, master best practices, and more? Preorder today and get $100 off of the launch price.
Find this useful? You can support my work by purchasing an annual membership.