Is it possible to save the function name as a string in JS and call it from an object that is pretty much similar to the PHP code below?
$this->$someFunc();
this[someFunc]();
Sure. Try the following:
var f = "foo"; var result = obj[f]();
where foo is the method on obj , or
foo
obj
this[f]();
where foo is the method in the current instance.
Source: https://habr.com/ru/post/1299251/More articles:https://translate.googleusercontent.com/translate_c?depth=1&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1299246/create-a-mirror-git-repository-without-transferring-objects&usg=ALkJrhhowHs3HfzW34CnMouuku7q8RwdCgMongoDB Group uses Ruby driver - ruby | fooobar.comThe likelihood of having a PC with a .net 2.0 card installed .netHow to build a PyObjC project on Mac OS X 10.6 that runs 10.5? - exceptionCan I use private APIs for an iPhone Enterprise app? - privateIs it possible to share a set of parameters and an NSUserDictionary object between applications? - iphoneRunning jar, setting classpath - javacalculating large roots: bigdecimal / java - javaHow can I generate random samples from two-dimensional normal and student T-bits in C ++? - c ++JavaScript is equivalent to C strncmp (compare string for length) - javascriptAll Articles