O'Reilly logo
  • Ahmed Elgendy thinks this is interesting:

What does the syntax myarray.push(value) actually mean?


A: Well, we’ve been keeping a little secret from you: in JavaScript, an array is actually a special kind of object. As you’ll learn in the next chapter, an object can have functions associated with it that act on the object. So, think of push as a function that can act on myarray. In this case, what that function does is add a new item to the array, the item that you pass as an argum...


Cover of Head First JavaScript Programming


How to add a value at the end of an array?