if the name of the property is stored in a variable, use []
foo[method]();
More Related Contents:
- How do I call a dynamically-named method in Javascript?
- How to call a parent method from child class in javascript?
- Why aren’t methods of an object created with class bound to it in ES6?
- Why is it necessary to set the prototype constructor?
- Javascript object members that are prototyped as arrays become shared by all class instances
- How is almost everything in Javascript an object?
- Preserving a reference to “this” in JavaScript prototype functions [duplicate]
- Assigning prototype methods *inside* the constructor function – why not?
- Declaring javascript object method in constructor function vs. in prototype [duplicate]
- Benefits of prototypal inheritance over classical?
- prototype based vs. class based inheritance
- Javascript: how to dynamically create nested objects using object names given by an array
- JavaScript private methods
- Create an instance of a class in ES6 with a dynamic name? [duplicate]
- Problems with circular dependency and OOP in AngularJS
- How to add my own methods to HTMLElement object?
- multiple conditions for JavaScript .includes() method
- Object vs Class vs Function
- Declare an empty two-dimensional array in Javascript?
- Define Private field Members and Inheritance in JAVASCRIPT module pattern
- What is the correct way to write HTML using Javascript?
- Dynamic controlgroup and checkboxes unstyled
- How can I create unique IDs with JavaScript?
- Typescript: can not access member value in inherited class constructor
- Can you alter a Javascript function after declaring it?
- The reason to use JS .call() method?
- OO Javascript constructor pattern: neo-classical vs prototypal
- Split a Javascript class (ES6) over multiple files?
- Jquery click function is not working for dynamic elements
- How can I load jQuery if it is not already loaded?