To execute a JavaScript function when its name is as a string, you can access class methods by name
Example
Live Demo
<html> <body> <script> class Demo { methodOne(){ document.write("50"); } methodTwo(){ this['methodOne'](); document.write("<br> 100"); } } let num = new Demo(); num['methodTwo'](); </script> </body> </html>