1.

What is the use of the push() method on the array?

Answer»
  • push() is one of the array detection mutation METHODS that mutate or change the ORIGINAL array. It alters or updates the original array by adding an element to its end. 
  • Since it is a mutation method there is no need to CREATE a new array rather the original array itself is modified by adding an element to the end of its original elements. 
arrayName.push({ attributeName: 'value' })


Discussion

No Comment Found

Related InterviewSolutions