JavaScript Frameworks – Why Duplicate Functions?

javascriptlibrariesweb-framework

I wonder why frameworks/libraries have their own helpers although they exist natively already.

Let's take jQuery and AngularJS. They have their own each iterator functions:

But we have Array.prototype.forEach.

Similarly,

But we have the JSON.parse() function in vanilla JavaScript.

Best Answer

Because when those libraries were written, some major browsers did not support those features. Once written and used, these features cannot be removed from these libraries without breaking many applications.

(In this case, "major browser" means a browser that still has large market share, which includes older versions of browsers like Internet Explorer, where large number of users don't necessarily upgrade to the latest version.)