Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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
Source by wesbos.com #
 
PREVIOUS NEXT
Tagged: #give #default #desctructured #object
ADD COMMENT
Topic
Name
4+2 =