string push javascript code example
Example 1: pushing to an array
array = ["hello"]
array.push("world");
console.log(array);
//output =>
["hello", "world"]
Example 2: string concatenation in js
var str1 = "Hello ";
var str2 = "world!";
var res = str1.concat(str2);
console.log(res);
Example 3: js add item to array
const fruits = ["Banana", "Orange", "Apple", "Mango"];
fruits.push("Kiwi");
Example 4: javascript array push
var fruits = [ "Orange", "Apple", "Mango"];
fruits.push("Banana");