Skip to main content

CommonJS

CommonJS (CJS) is a complement to the JavaScript scripting language. With CommonJS, JavaScript can also be used outside the traditional browser environment. This use is made possible by newly developed interfaces, libraries and modules that create a uniform basis for the integration of JavaScript in different environments.
[su_list icon=”icon: bell” icon_color=”#187bc0″ indent=”-5″]

Background of CommonJS

Hardly any website in the World Wide Web can do without JavaScript. The scripting language can be interpreted by any web browser nowadays and thanks to Node.js, JavaScript can also be used on the web server in the backend of a webapp. For many years, JavaScript could only be used in the browser. In 2009, programmer Kevon Dangoor introduced CommonJS to the general public, paving the way to make JavaScript usable outside of the browser. Shortly after the release of the first version of CJS, the first libraries and modules were already ready and in the meantime, the scripting language has become much more flexible and dynamic thanks to this addition. CommonJS offers developers many advantages, such as:

  • A unified module system
  • private classes, methods and variables
[/su_list]

Modularization of the JavaScript source code

JavaScript

, unlike traditional object-oriented languages such as Java or Python, does not provide support for classes. The module pattern of CommonJS is used to mimic exactly these classes. This allows objects to be implemented that make programming with JavaScript much easier.

You might also be interested in our JavaScript glossary:

To the article

Do you have any more questions?

Please contact us


Further contents