Tag Info

New answers tagged

4

The problem is the global scope. In other words, every change you make affects the whole code base, and yours may in turn be affected in any location of the code base. Imagine that you want to loop through all elements of an array; imagine that browsers don't support it yet. For that, you create a method forEach which is called this way: [5, 7, 1, 1, ...


1

Abhi explained on Stack Overflow why you don't want to do it to common objects, but for your own class, that's the way of doing it. So in short, the answer is DEPENDS. When you extend an object, you change its behaviour. Changing the behaviour of an object that will only be used by your own code is fine. But when you change the behaviour of ...



Top 50 recent answers are included