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
);
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
);
destructuring assignment in javascript
// destructuring assignment in javascript
// object destructuring
let person = {
name: "Chetan",
age: 30,
country: "India"
};
const { name, age } = person;
console.log(name);
//expected output: "Chetan"
console.log(age);
//expected output: 30
console.log(country);
//expected output: Uncaught ReferenceError: country is not defined
// Array destructuring
const num = [1,2,3];
const [one, two, three] = num;
console.log(one); // 1
console.log(two); // 2
console.log(three); // 3
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us