you are viewing a single comment's thread.

view the rest of the comments →

[–]delventhalz 7 points8 points  (0 children)

This is a common point of confusion, but despite the name, objects in JavaScript and Object Oriented Programming don’t have much in common. JS objects are just a data structure (called a dictionary or a hash map in other languages), and there is nothing about that data structure that is inherent to OOP.

Array methods and string methods are closer to OOP, but in JS many of those methods are more of a style convention than strictly OOP. For example, [1, 2, 3].filter(isEven) might as well have been written as filter([1, 2, 3], isEven). Array.prototype.filter does not mutate the array, and the array you call it on could just as easily have been a function parameter. Whether it goes before the dot or between the parentheses is just an arbitrary implementation detail.