I have to create a string in format like below
"currentState[0]['children'][1]"
But I need to execute it later just like below
currentState[0]['children'][1]
I have elements and childrens on currentState. But while looping I have to create a string. But later I need to execute as array.
I have tried almost all array methods. Array.call, bind etc. And string methods as well. Could not get the output
How can I make it
$str = "currentState[0]['children'][1]". Then: $test = eval($str);evalwill get the job done, but;evalis frowned upon because it can be used for a wide variaty of attacks on your code, your application, your user, ...