Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Destructuring objects by extracting properties of variables with dynamic values

const myTitle= 'title';

const myObject = {title: 'My Title', name: 'My Name'};
const {[myTitle]: myObjectTitle} = myObject;

console.log(myObjectTitle); // "My Title"
Source by blog.debugeverything.com #
 
PREVIOUS NEXT
Tagged: #Destructuring #objects #extracting #properties #variables #dynamic #values
ADD COMMENT
Topic
Name
8+9 =