You are reading a single comment by @MarcEvan and its replies. Click here to read the full conversation.
  • Can you specify multiple classes in a module? If so, how do
    you reference them individually after a requires() invocation?

    --- modules/animals.js ---

    class Animal { }
    class Dog extends Animal { }
    class Cat extends Animal { }

    exports = Dog, Cat;


    var animals = require("animals");

    var d = new Dog();
    var c = new Cat();

    Uncaught ReferenceError: "Dog" is not defined
    at line 2 col 5
    var d=new Dog();

    Uncaught ReferenceError: "Cat" is not defined
    at line 3 col 5
    var c=new Cat();

About

Avatar for MarcEvan @MarcEvan started