Advertisement
WildCrystal

Question

Jul 23rd, 2023
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | Source Code | 0 0
  1. // Given 3 functions
  2.  
  3. function plus_one(x) {
  4. return x + 1;
  5. }
  6. function trans(func) {
  7. return x => 2 * func(x * 2);
  8. }
  9. function twice(func) {
  10. return x => func(func(x));
  11. }
  12.  
  13. // What’s the output?
  14.  
  15. // 1.
  16. console.log(((twice(trans))(plus_one))(1));
  17. // 2.
  18. console.log(((twice(trans(plus_one))))(1));
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement