Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

arrow function in javascript

// arrow function shorten way to write function
//it make easy to write callback function
const arrowFunction = names.map((name)=> {
return name.length <6 ? "long name" :"short name"
})
//if we have one parameter in callback function we don't need to add parenthesis ()
//if there is only one code logic and return value then we can remove return and {}
const arrowFunction = names.map(name=> name.length<10 ? "long name" :"short name" )
Source by softhunt.net #
 
PREVIOUS NEXT
Tagged: #arrow #function #javascript
ADD COMMENT
Topic
Name
9+9 =