what does .push do in javascript code example
Example 1: javascript pushing to an array
some_array = ["John", "Sally"];
some_array.push("Mike");
console.log(some_array);
["John", "Sally", "Mike"]
Example 2: javascript array push
var SomeRandomArray = [];
SomeRandomArray.push("Hello, world!");
Example 3: how to append object in array javascript
var select =[2,5,8];
var filerdata=[];
for (var i = 0; i < select.length; i++) {
filerdata.push(this.state.data.find((record) => record.id == select[i]));
}
Example 4: javascript array push
let items_in_backpack = ['food', 'water', 'flashlight', 'GPS'];
items_in_backpack.push('javascript array push knowledge');
Example 5: js push
let arr = [9, 4, 3, 18]
arr.push(30)
console.log(arr)