Javascript function name stored in a variable

I have as javascript function name stored in a variable:
var fName = "getInfo()";

Please let me know how I can use it to retrieve a value like this:
this.listingsData[0].getInfo();

I want to use fName to do the same job.

Thanks!
dshrenikAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
mapeck65Connect With a Mentor Commented:
You should be able to do something like this...

//Declare the function:
var fName = this.listingsData[0].getInfo();

//Call the function:
fName();

For more info, do a search for Javascript Closures.

Good luck!
0
All Courses

From novice to tech pro — start learning today.