Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function add(a, b) { return a + b; }
- function sub(a, b) { return a - b; }
- function calculator(op, a, b) { return op(a, b); }
- console.log(calculator(add, 2, 3));
- console.log(calculator(sub, 5, 1));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement