The class expression is one way to define a class in ECMAScript 2015. There is two ways to define a class expresion:
class nombreDeLaClase {
constructor(maker, price) {
this.maker = maker;
this.price = price;
}
getInfo() {
console.log(this.maker + " costs : " + this.price);
}
toString() {
return `${this.maker} costs : ${this.price}`;
}
}
The class expression is one way to define a class in ECMAScript 2015. There is two ways to define a class expresion:
var nombreDeLaClase = class c {
…
console.log(c)
}
var nombreDeLaClase = class c {
…
console.log(c)
}
Hay tres tipos
class nombreDeLaClase {
constructor(maker, price) {
this.maker = maker;
this.price = price;
}
...
}
class Car {
...
static count() {
console.log("I am static method");
}
}
Car.count();
Car.count();
class Car {
...
getInfo() {
console.log(this.maker + " costs : " + this.price);
}
}
Since you're also assigning the variable as a property of exports:
exports.ConversationModule = ConversationModule;
you'd have to call it like this:
var ConversationModule = require('./file').ConversationModule;
ConversationModule.sayhello();
If you don't want to do that, assign the object to module.exports:
module.exports = ConversationModule;
And call it like this:
var ConversationModule = require('./file');
ConversationModule.sayhello();