Answers for "how to give default value to desctructured object"

0

how to give default value to desctructured object

const settings = {
    speed: 150
}
const { speed = 750, width = 500 } = settings;
console.log(speed); // 150 - comes from settings object
console.log(width); // 500 - fallback to default
Posted by: Guest on February-12-2021

Code answers related to "how to give default value to desctructured object"

Code answers related to "Javascript"

Browse Popular Code Answers by Language