how to push string into array in javascript
snippet in javascript

append array js

user7754

var colors= ["red","blue"];
	colors.push("yellow"); //["red","blue","yellow"]

javascript pushing to an array

user114

some_array = ["John", "Sally"];
some_array.push("Mike");

console.log(some_array); //output will be =>
["John", "Sally", "Mike"]

how to push string into array in javascript

user9813

var arr = ["Hi","Hello","Bonjour"];
arr.push("Hola");
console.log(arr);

js add item to array

user7544

const fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.push("Kiwi");

array.push

user3483

var vegetables = ['Capsicum',' Carrot','Cucumber','Onion'];
vegetables.push('Okra');
//expected output ['Capsicum',' Carrot','Cucumber','Onion','Okra']; 
// .push adds a thing at the last of an array