1
Guys I have trouble in angular
I have my object
user = {name: 'Alexandre', email: '[email protected]'}
I need a way to show on the console
var attr = 'name';
var attr2 = 'email';
insira o código aqui
console.log(user.attr) e me retorne Alexandre;
console.log(user.attr2) e me retorne '[email protected];
The second parameter of the object would be dynamically variable, as I can execute?
I’ve tried it like this and nothing right
user.attr;
user.{attr};
user.(attr);
Thank you I didn’t know you could access as an array type
– TutiJapa Wada