Q:

how to append to an array

var fruits = ["Banana", "Orange", "Apple", "Mango"];

fruits.push("Kiwi"); 
0
let foo = ['oop','plop','copo'];
	foo.push("plop");
6
// initialize array
var arr = [
  "Hi",
  "Hello",
  "Bonjour"
];

// append new value to the array
arr.push("Hola");

console.log(arr);
3

Tags

Related

New to Communities?

Join the community