cevilio

Javascript Lambda Expression Example

Jul 29th, 2018
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. var xa = function(a) {
  2. return a;
  3. }
  4.  
  5. var xl = a => a;
  6.  
  7. var x = () => { console.log("hi"); };
  8. x();
  9.  
  10. //console.log(xl("hi"));
  11.  
  12.  
  13. var sum = (a,b,c) => a+b+c;
  14. console.log(sum(3,4,5));
  15.  
  16.  
  17. setTimeout( function() { console.log("timeout");}, 200);
  18. setTimeout(() => console.log("timeout lambda"), 200);
  19.  
  20.  
  21. //function multiply(a,b) {
  22. // return a*b;
  23. //}
  24.  
  25. var multiply = (a,b) => a*b;
  26. console.log(multiply(2,3));
  27.  
  28. (() => {
  29. this.speed = 0;
  30. setInterval( () => {
  31. this.speed++;
  32. console.log(this.speed);
  33. }, 200
  34. );
  35. })();
Advertisement
Add Comment
Please, Sign In to add comment