I am trying to create my own module in node.js that I can use later.
For learning purpose I have created a javaScript class to practice this kind of stuff unfortunately I have no idea how to use it properly.
My class:
class Taschenrechner {
let plus = (param1, param2) => {
return param1 + param2;
}
let minus = (param1, param2) => {
return param1 - param2;
}
let mal = (param1, param2) => {
return param1 * param2;
}
let geteilt = (param1, param2) => {
return param1 / param2;
}
let potenz = (param1, param2) => {
return param1 ** param2;
}
}
So let just say I want to export all these functions so that I can use them like this:
let calculator = require("taschenrechner");
calculator.add(4, 4);
Something like that... (I'm still a rookie as you can see :D)
The official node modules use something like .exports is this something I could/should use for my own code as well?