Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Implicit Return Shorthand in javascript

// Implicit Return Shorthand in javascript
// Longhand:
function calcCircumference(diameter) {
    return Math.PI * diameter
  }
console.log(calcCircumference(10)); //31.41592653589793
  
// Shorthand:
calcCircumference_ = diameter => Math.PI * diameter
console.log(calcCircumference_(10)); //31.41592653589793
 
PREVIOUS NEXT
Tagged: #Implicit #Return #Shorthand #javascript
ADD COMMENT
Topic
Name
3+8 =