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

  • SEARCH
  • Home
  • 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 7179313
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T17:06:54+00:00 2026-05-28T17:06:54+00:00

I was trying out Joose with node.js and managed to produce code like this:

  • 0

I was trying out Joose with node.js and managed to produce code like this:

require('joose'); // WHAT?

Class("Dog", {
    methods: {
        bark: function() { console.log('woof'); }
    }
});

var dog = new Dog();
dog.bark();

I have thought that every require in node.js must be assigned to a variable, contrary to PHP in which you just require the file and it works as if you’d copy its contents to that place.

In this situation Class seems to infiltrate the main scope by itself since if I remove the require statement I get a ReferenceError: Class is not defined.

How does this work?

  • 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-28T17:06:54+00:00Added an answer on May 28, 2026 at 5:06 pm

    Joose injects the global variable Class (global.Class = …), that’s why it’s visible without assigning it into your code specifically.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was trying out this code. execute EXE from memory I am hitting on
I'm currently trying out db4o (the java version) and I pretty much like what
I'm trying out the following query: SELECT A,B,C FROM table WHERE field LIKE 'query%'
been trying out this for quite some time but I'm still unable to built
I'm trying out my first recursive function (at least I think I am!) and
Trying out Linq for NHibernate and first noticed this: var list1 = (from ut
I've been trying out IntelliJ IDEA for JavaScript editing, and I like it so
I'm trying out http://emacspeak.sourceforge.net now that I have it running on windows. I'd like
I have been trying out EF 4.1 ( code first ) with MVC 3.
I'm trying out very simple search popup on the JqGrid. Please see the code

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.