how to push string into array in javascript
var colors= ["red","blue"];
colors.push("yellow"); //["red","blue","yellow"]var arr = ["Hi","Hello","Bonjour"];
arr.push("Hola");
console.log(arr);some_array = ["John", "Sally"];
some_array.push("Mike");
console.log(some_array); //output will be =>
["John", "Sally", "Mike"]const fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.push("Kiwi");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
Also in JavaScript:
- math js
- div gets pulled to corner when resizing
- javascript buttons
- number is even or odd fucntion in javascript
- how to recognize an array in javascript
- jquery change position animate
- javascript dynamic arrays
- javascript get list of files in directory
- how to replace array element in javascript without mutation
- how to generate random string in node js
- npm md to html
- ngcc failed angular 9
- how to push string into array in javascript
- NameError: name 'jsonify' is not defined
- enzyme hasclass example
- node js read files recursively
- check if palindrome
- operator to return specific data of a mongodb query
- javascript dynamic table row add
- javascript objet keys comparaison
- how to auto close alert box javascript
- mometjs
- make shorter if statements with objects
- js find key by value in object