Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

arrow function javascript

const power = (base, exponent) => {
  let result = 1;
  for (let count = 0; count < exponent; count++) {
    result *= base;
  }
  return result;
};

//if the function got only one parameter

const square1 = (x) => { return x * x; };
const square2 = x => x * x;

// empty parameter

const horn = () => {
  console.log("Toot");
};
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #arrow #function #javascript
ADD COMMENT
Topic
Name
7+7 =