Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3431536
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T07:20:16+00:00 2026-05-18T07:20:16+00:00

From time to time I hear that CommonJS http://www.commonjs.org/ is an effort to create

  • 0

From time to time I hear that CommonJS http://www.commonjs.org/ is an effort to create a set of modular javascript components but frankly I have never understood anything of it.

Where are the these modular components I can use? I don’t see much on their homepage.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T07:20:17+00:00Added an answer on May 18, 2026 at 7:20 am

    CommonJS is only a standard that specifies a way to modularize JavaScript, so CommonJS itself does not provide any JavaScript libraries.

    CommonJS specifies a require() function which lets one import the modules and then use them, the modules have a special global variable named exports which is an object which holds the things that will get exported.

    // foo.js ---------------- Example Foo module
    function Foo() {
        this.bla = function() {
            console.log('Hello World');
        }
    }
    
    exports.foo = Foo;
    
    // myawesomeprogram.js ----------------------
    var foo = require('./foo'); // './' will require the module relative
                                // in this case foo.js is in the same directory as this .js file
    var test = new foo.Foo();
    test.bla(); // logs 'Hello World'
    

    The Node.js standard library and all 3rd party libraries use CommonJS to modularize their code.

    One more example:

    // require the http module from the standard library
    var http = require('http'); // no './' will look up the require paths to find the module
    var express = require('express'); // require the express.js framework (needs to be installed)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

From time to time you hear stories that are meant to illustrate how good
From time to time I read that Fortran is or can be faster then
From time to time, a file that I'm interested in is modified by some
Okay I hear that thing all the time on internet when reading an article
Reading questions, comments and answers on SO, I hear all the time that MSVC
This is something that causes me some pause from time to time. It seems
I see, from time to time, that people say that SQL query that is
In my alarm application, I take time from time picker and set it in
From time to time I see an enum like the following: [Flags] public enum
From time to time I get a System.Threading.ThreadStateException when attempting to restart a thread.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.