Answers for "Arrow Functions"

3

arrow function rec

(param1, param2, …, paramN) => { statements } 
(param1, param2, …, paramN) => expression
// equivalent to: => { return expression; }

// Parentheses are optional when there's only one parameter name:
(singleParam) => { statements }
singleParam => { statements }

// The parameter list for a function with no parameters should be written with a pair of parentheses.
() => { statements }
Posted by: Guest on July-07-2020
0

arrow function in javascript

//function old way
function PrintName(name){
  console.log("my name is ", name) ;
}
// Arrow function es6
const PrintName =  (name) => {
  return console.log("my name is " , name) ;
}
Posted by: Guest on October-13-2020
3

arrow function javascript

const suma = (num1, num2) => num1+num2
console.log(suma(2,3));
//5
Posted by: Guest on September-11-2020
20

arrow function javascript

//If body has single statement
let myFunction = (arg1, arg2, ...argN) => expression

//for multiple statement
let myFunction = (arg1, arg2, ...argN) => {
    statement(s)
}
//example
let hello = (arg1,arg2) => "Hello " + arg1 + " Welcome To "+ arg2;
console.log(hello("User","Grepper"))
//Start checking js code on chrome inspect option
Posted by: Guest on December-07-2020
2

Arrow Functions

// The usual way of writing function
const magic = function() {
  return new Date();
};

// Arrow function syntax is used to rewrite the function
const magic = () => {
  return new Date();
};
//or
const magic = () => new Date();
Posted by: Guest on January-03-2021
2

how to make javascript function consise

multiplyfunc = (a, b) => { return a * b; }
Posted by: Guest on April-04-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language