5
자바 스크립트는 문자열에서 동적으로 객체 메소드를 호출합니다.
메서드 이름을 문자열로 갖는 개체 메서드를 동적으로 호출 할 수 있습니까? 나는 다음과 같이 상상할 것입니다. var FooClass = function() { this.smile = function() {}; } var method = "smile"; var foo = new FooClass(); // I want to run smile on the foo instance. foo.{mysterious code}(); // being executed …