How to append something to an array? How to append something to an array? arrays arrays

How to append something to an array?


Use the Array.prototype.push method to append values to the end of an array:

// initialize arrayvar arr = [  "Hi",  "Hello",  "Bonjour"];// append new value to the arrayarr.push("Hola");console.log(arr);