nodejs add element to array code example
Example 1: javascript append to array
var colors=["red","white"];
colors.push("blue");
Example 2: javascript append element to array
var colors= ["red","blue"];
colors.push("yellow");
Example 3: nodejs add element to array
var array = [];
array.push(element)
console.log(array);
Example 4: javascript add items to array
objects = [];
objects.push("you can add a string,number,boolean,etc");
objects.push({variable1 : value, variable2 : value);
Example 5: array.push
var vegetables = ['Capsicum',' Carrot','Cucumber','Onion'];
vegetables.push('Okra');
Example 6: js append to array
var array = [0,1,3];
array.append(5);
console.log(array);