Skip to main content Accessibility Feedback

Arrays

Array.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);