How to dynamic call property on javascript object with jQuery
- by Massimo Ugues
Hallo all.
I got a javascript object with some propeties let's say
function Animal() {
this.id;
this.name;
I need to call id function in a dynamic way to get and set its value: something like this
Animal animal = new Animal();
var propertyName = "id";
animal.+propertyName = "name";
Is there an elegant way to do it? With jQuery?
Kind regards
Massimo