Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JavaScript: What is the equivalent of PHP's "$this->$somefunc()"?

Tags:

javascript

Is it possible to store the name of a function as string in JS, and invoke it from an object, pretty much like the PHP code below?

$this->$someFunc();
like image 947
Extrakun Avatar asked Nov 30 '22 19:11

Extrakun


1 Answers

this[someFunc]();
like image 97
troelskn Avatar answered Dec 05 '22 06:12

troelskn