Jump to content

Variable construction


x1nick

Recommended Posts

No idea what the correct naming is for this...

 

In php you can do things like this

 

$variable = 'my_class_name';

new $variable()

 

or

$variable = "class_{$class_name}"

new $variable()

 

I want to be able to do something similar in javascript, is this possible?

 

This is my line of javascript which is clearly not going to work, but idx and file will change

App.{idx}.{file} = new App.View.{file}

 

Cheers

Link to comment
https://forums.phpfreaks.com/topic/251992-variable-construction/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.