Skip to content

Instantly share code, notes, and snippets.

@jessecogollo
Created October 23, 2017 06:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jessecogollo/32f1903dd239d85dcc83348af6b275bf to your computer and use it in GitHub Desktop.
Save jessecogollo/32f1903dd239d85dcc83348af6b275bf to your computer and use it in GitHub Desktop.
inherits
'use strict';
const {
Calc
} = require('./modules/util');
const calc = new Calc();
console.log('calc', Calc);
console.log('add', calc.add(2, 3));
console.log('subtract', calc.subtract(5, 3));
'use strict';
const {
inherits
} = require('util');
function CalcExtend () {
};
CalcExtend.prototype.add = (n1, n2) => {
return n1 + n2;
};
function Calc () {
};
inherits(Calc, CalcExtend);
Calc.prototype.subtract = (n1, n2) => {
return n1 - n2;
};
module.exports = {
Calc
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment