how to add attribute in js object as string and use it as dot code example
Example 1: add property to object javascript
let yourObject = {};
//Examples:
//Example 1
let yourKeyVariable = "yourKey";
yourObject[yourKeyVariable] = "yourValue";
//Example 2
yourObject["yourKey"] = "yourValue";
//Example 3
yourObject.yourKey = "yourValue";
Example 2: add property with value in js
var myObject = {
sProp: 'some string value',
numProp: 2,
bProp: false
};