Dynamic Object Initialization In JavaScript (just like PHP Reflection allows)?

Posted by Gcoop on Stack Overflow See other posts from Stack Overflow or by Gcoop
Published on 2010-04-23T09:15:42Z Indexed on 2010/04/23 9:23 UTC
Read the original article Hit count: 178

Hi All,

Using Reflection in PHP I can dynamically create a object like so

$target = 'core_domain_Person';
$reflect = new ReflectionClass($target);
$obj = $reflect->newInstance();

I would like to replicate this same concept in JavaScript is there a way to do this out of the box? Or is there a way to replicate what Reflection is doing?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about design-patterns