Once upon a time, there were a number of popular JavaScript libraries such as jQuery, MooTools, Prototype, Dojo and YUI created for accomplishing common JavaScript tasks in a browser-agnostic way. These libraries provided functions across a wide swath of browser functionality, from events, the DOM, to AJAX. Nowadays, a lot of the newer libraries are targeting mobile app development. Here are some of the top JS libraries right now.
React is a JavaScript library for building user interfaces. It helps you to build encapsulated components that manage their own state, as well as combine them into complex UIs. Component logic is written in JavaScript (as opposed to templates) so that rich data can easily be passed through the app and keep state out of the DOM.
Moreover, React employs declarative views to make your code more predictable and easier to debug. You can design a simple view for each state in your application, and React will efficiently update and render the appropriate components when your data changes.
Backbone is a library for creating data models and views that decouples your data from the DOM. Whenever a UI action causes a model’s attribute to change, the model triggers a “change” event. Views that display the model’s state can be notified of the change, so that they are able to respond accordingly, re-rendering themselves with the new information.
Popular apps that use Backbone include DocumentCloud, USA Today, Rdio, Hulu, and Gawker Media.
Ember or Ember.js is a framework for creating web applications using handlebar templates. Handlebars are automatically updated whenever the underlying model changes, ensuring that the HTML stays up-to-date. This is all done without any additional JavaScript. Ember also provides a number of components. These allow you to create your own application-specific HTML tags, using Handlebars to describe their markup along with JavaScript to implement custom behavior.
Ember is used on many popular websites, including Discourse, Groupon, LinkedIn, Vine, Live Nation, Nordstrom, Twitch.tv and Chipotle.
D3 (which stands for Data-Driven Documents) is a JavaScript library for manipulating documents based on data. Hence, it is a data-driven approach to DOM manipulation. D3 allows you to bind data to a Document Object Model (DOM), and then apply data-driven transformations to map the data to a UI element. For example, you can use D3 to transform an array of numbers into an HTML table. The same data may also be utilized to create an interactive SVG bar chart with smooth transitions and interaction.
Data visualization company Datameer uses D3.js as its core technology, while The New York Times sometimes uses it for rich graphs. It is also used by the iD editor for editing OpenStreetMap.
Babylon.js is a JavaScript framework for building 3D games using HTML5, WebGL and Web Audio. Features include Collisions/Physics/Animations/Optimizations engines, lighting/Mirror/Emissive/Specular/Bump textures, Special FX such as fog, Alpha blending, Billboarding, & Shadow Maps, Cameras, and Meshes. Compared to similar engines, Babylon is heavy on code and places less emphasis on tools.
They have a Playground that you can test your code on.
One of the oldest JS libraries in use today (it was first released in 2006), jQuery was designed by John Resig to simplify client-side scripting across a multitude of browsers. It is the most popular JavaScript library in use today, with installation on 65% of the top 10 million highest-trafficked sites on the Web. jQuery is a fast, small, and feature-rich JavaScript library, known for its nimble document traversal and manipulation, event handling, animation, and Ajax abilities. With a combination of versatility and extensibility, jQuery continues to influence the way that millions of web developers write JavaScript.
Three.js is a lightweight cross-browser JavaScript library/API used to create and display animated 3D computer graphics on a Web browser. Using WebGL, it allows the creation of GPU-accelerated 3D animations using JavaScript without relying on proprietary browser plugins. Like Babylon.js, three.js is also employed to build 3D games. Today, the project source code resides on Github and has over 650 contributors.
There is an online editor that allows you to run various examples and try out your own ideas.
Babel is a JavaScript compiler that takes a form of JS shorthand and converts it into full statements. This offers several advantages, including offering the ability to use new ES2015 syntax, without waiting for browser support. For instance, the following statement using arrow functions:
[1,2,3].map(n => n + 1);
maps to
[1,2,3].map(function(n) { return n + 1; });
Mocha is a JavaScript test framework running on node.js that features browser support, asynchronous testing, test coverage reports, and use of any assertion library. It also supports asynchronous process testing. Mocha tests run serially, allowing for flexible and accurate reporting, while mapping uncaught exceptions to the correct test cases.
Mocha users include Accenture, Redbooth, CrowdRiff, and Verdigris.