calc.js

const add = (a,b) => a + b;
const sub = (a,b) => a - b;

module.exports = {
	
    modulename: "calc module",
    add: add,
    sub: sub,
}

index.js

const calc = require("./calc")

console.log(calc.add(1,2));
console.log(calc.add(4,5));
console.log(calc.sub(10,2));

+ Recent posts