O'Reilly logo

Learning Underscore.js by Alex Pop

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Reusing code based on Underscore between client and server

One of the biggest advantages of using JavaScript for client-server applications is the possibility of code reuse between the two environments. For example, one can easily envisage a validation utility that could be used to validate data on the client and then again on the server. Class definitions are another good example of code that can be reused.

Before ES6, JavaScript did not have any built-in concept of code encapsulation or modularization, unlike other languages such as Java, C#, or Ruby. ES6 solves this problem by standardizing modules and classes, but stops short of standardizing a module loader. A separate ECMAScript module loader specification is under development and published ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required