Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js Destructuring arguments

const circle = {
  label: 'circleX',
  radius: 2,
};

const circleArea = ({ radius }, [precision = 2]) =>
  (Math.PI * radius * radius).toFixed(precision);

console.log(
  circleArea(circle, [5]) // 12.56637
);
Source by jscomplete.com #
 
PREVIOUS NEXT
Tagged: #js #Destructuring #arguments
ADD COMMENT
Topic
Name
5+8 =