Possible en double:
Get property of object in JavaScriptComment accéder aux méthodes des objets javascript avec une variable?
var Terminal = function() {
this.walk = function() {
alert('hello');
}
this.go = 'walk';
this.move = 'walk';
}
var term = new Terminal();
var fn = 'walk';
if (term.hasOwnProperty(fn)) {
term.{fn};
}
Comment puis-je utiliser la méthode term.walk() en utilisant 'marcher' la chaîne?
http://stackoverflow.com/questions/3695243/get-property-of-object-in-javascript Cela a été demandé à plusieurs reprises. – user113716