Created
October 23, 2017 06:37
-
-
Save jessecogollo/32f1903dd239d85dcc83348af6b275bf to your computer and use it in GitHub Desktop.
inherits
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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