node.js - convert a string to JSON Object with same name (Need this for some sort of dynamic code in js) -


var objname = "person";   //if assign "institute" need institute json object //i have global person json many attributes. var thisobj = objname.toobject(); //need of kind  //i know eval can used, checking other better way this. 

please advise if there better way convert string object of name in nodejs, sails js

it not technically possible in es5 javascript want without use of eval. have eluded to, not idea use eval in situation (or pretty all). alternative such david suggested go-to now.


Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -