What is the use of Push method in JavaScript?
You can use push()
method in JS arrays to add some item to them in the end.
Example:
const ar = [];
ar.push(1)
ar.push(2)
console.log(ar) // [1,2]
What is the use of Push method in JavaScript?
You can use push()
method in JS arrays to add some item to them in the end.
Example:
const ar = [];
ar.push(1)
ar.push(2)
console.log(ar) // [1,2]