SHARE
TWEET

Untitled

a guest Aug 20th, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // parameter หลายตัว ////////////////////////////
  2. let addSync = function (a, b) {
  3.   return a + b;
  4.  }
  5.  
  6. let addSync = (a, b) => {return a + b;}
  7.  
  8. let addSync = (a, b) => a + b;
  9.  
  10. // parameter ตัวเดียว ///////////////////////////
  11. let powerOfTwo = function(a) {
  12.   return a* a;
  13. }
  14.  
  15. let powerOftwo = a => (
  16.   a * a
  17. );
  18.  
  19. let powerOfTwo = a => a * a;
  20.  
  21. // ใช้กับการ loop ใน list ///////////////////////////
  22. list.forEach(function(item) {
  23.   console.log(item);
  24. });
  25.  
  26. list.forEach(item => console.log(item));
  27.  
  28. // return Object ///////////////////////////
  29. let getEmployee = function () {
  30.   return {
  31.     "id" : 1,
  32.     "name" : "TheUncle"
  33.   };
  34. }
  35.  
  36. let getEmployee = () => ({"id" : 1, "name" : "TheUncle"});
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top