Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const _ = require('lodash');
- module.exports = class Calculator {
- constructor(items){
- this.calc = _.filter(items,
- function(o , index){
- if(!_.isNumber(o))
- console.log(" bledny typ argumentu: " + "["+index+"] "+o)
- return _.isNumber(o)
- }
- )
- }
- sum(){
- console.log(_.reduce(this.calc, function(sum,n){return sum+n}))
- }
- substract(){
- console.log(_.reduce(this.calc, function(sub,n){return sub-n}))
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement