If there is:
var obj = {a: 'This is a', b: 'This is b', c: 'This is c'}
var select = 'b';
How can I make to work something like this:
console.log(obj.select); // This would output: This is b
If there is:
var obj = {a: 'This is a', b: 'This is b', c: 'This is c'}
var select = 'b';
How can I make to work something like this:
console.log(obj.select); // This would output: This is b
Use
bracket notation
var obj = {
a: 'This is a',
b: 'This is b',
c: 'This is c'
}
var select = 'b';
console.log(obj[select]);