javascript get value from dynamic object name code example
Example 1: dynamic properties instead javascript
var foo = { pName1 : 1, pName2 : [1, {foo : bar }, 3] , ...}
var name = "pName"
var num = 1;
foo[name + num]; // 1
// --
var a = 2;
var b = 1;
var c = "foo";
foo[name + a][b][c]; // bar
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