I think the main advantage is being able to control what is displayed when listing the properties of an object, such as for in or Object.keys() .
MDN explains this well with Object.defineProperty : https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/defineProperty
So usually, when people want to add a method to an Object , for example, a polyfill for some method that is not supported in older browsers, they modify .prototype . But this makes the property enumerable and confuses what is returned in the collection of loops / keys ( without using .hasOwnProperty ), which not everyone uses).
So, instead of something like:
Object.prototype.myMethod = function () { alert("Ahh"); };
you can use Object.defineProperty to explicitly say that it cannot be enumerated:
Object.defineProperty(Object.prototype, 'myMethod', { value: function () { alert("Ahh"); }, enumerable: false });
Thus, for example, when you use for (var key in obj) , "myMethod" will not be an enumerated element, and you do not have to worry about using .hasOwnProperty . The main problem is that some browsers, of course, do not support it: http://kangax.github.com/es5-compat-table/ and that not all libraries / code use it, so you can not always rely on external libraries / code for proper use and all the time.
You can access an enumerable property at any time, it simply will not appear when listing the properties of an object - this is the main point.
And I believe that all the "predefined" properties of objects are not enumerable. By this, I really mean only my own properties, not necessarily inherited or created. So, in your example pop and push will not be listed, but Array.prototype.indexOf will be if it is created as polyfill in an old browser that does not support this method ... which, of course, can be avoided by using Object.defineProperty , like my example is above. Another example is the length property, which is not enumerable.
Here is an example in general: http://jsfiddle.net/aHJ3g/
The use and definition of Object.keys is important: "Returns an array of the specified objects of their own enumerable properties in the same order as in the for-in loop (the difference is that the for-in loop enumerates the properties in the prototype chain). - from MDN - https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/keys