interpolate into class property name js code example
Example 1: dynamic object property name javascript
let me = {
name: 'samantha',
};
// 1. Dot notation
me.name; // samantha
// 2. Bracket notation (string key)
me['name']; // samantha
// 3. Bracket notation (variable key)
let key = 'name';
me[key]; // samantha
Example 2: nodejs how to use dynamic variable after dot
model.car // static way
const myDynamicVariable = 'car'
model[myDynamicVariable] // works like model.car - here you can dynamicly use a variable after dot