wilded
3/14/2019 - 1:45 PM

Javascript Arrow Functions

/* Without Arrow Function */
const sayHello = function(name){
  return "Hello " + name + " !"; 
}
let var = sayHello("John");

/* With Arrow Function W/One line of code */
const sayHello = (name) => `Hello  ${name}!`;
let var = sayHello("John");

/* With Arrow Function W/One more lines of code */
const sayHello = (name) => {
  `Hello  ${name}!`;
  ....
}
let var = sayHello("John");

----------------------------

// ES5
var x = function(x, y) {
   return x * y;
}

// ES6
const x = (x, y) => x * y;