Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Javascript one parameter fat arrow

//When there is only one parameter name, you can omit the parentheses around the parameter list. If the body is a single expression, rather than a block in braces, that expression will be returned from the function. So, these two definitions of square do the same thing:
const square1 = (x) => { return x * x; };
const square2 = x => x * x;
 
PREVIOUS NEXT
Tagged: #Javascript #parameter #fat #arrow
ADD COMMENT
Topic
Name
6+3 =