Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Given 3 functions
- function plus_one(x) {
- return x + 1;
- }
- function trans(func) {
- return x => 2 * func(x * 2);
- }
- function twice(func) {
- return x => func(func(x));
- }
- // What’s the output?
- // 1.
- console.log(((twice(trans))(plus_one))(1));
- // 2.
- console.log(((twice(trans(plus_one))))(1));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement