Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function someAction(x, y, someCallback) {
- return someCallback(x, y);
- }
- function calcProduct(x, y) {
- return x * y;
- }
- function calcSum(x, y) {
- return x + y;
- }
- // alerts 75, the product of 5 and 15
- alert(someAction(5, 15, calcProduct));
- // alerts 20, the sum of 5 and 15
- alert(someAction(5, 15, calcSum));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement