Answers for "javascript object destructuring rename"

8

javascript object destructuring rename

// Renaming
// ----------------------------------------------
const { bar: foo } = { bar: 123 };
bar // Uncaught ReferenceError: bar is not defined
foo // 123


// Renaming with default value
// ----------------------------------------------
const { bar: foo = 123 } = { potato: 456 };
bar // Uncaught ReferenceError: bar is not defined
foo // 123
potato // Uncaught ReferenceError: potato is not defined
Posted by: Guest on November-27-2020

Code answers related to "javascript object destructuring rename"

Code answers related to "Javascript"

Browse Popular Code Answers by Language