javascript - give name of a Variable from member of array -


i want give name of variable member of array below ... show's syntaxerror: parse error

var nemads=new array("akhaber","mafakher"); var nemads[i] = new stocks(nemads[i],urls[i],""); 

what can ?

kind of, this:

var nemads=new array("akhaber","mafakher"); var arr = {};  (var = 0; < nemads.length; ++i) {     arr[nemads[i]] = "test" + i; }  (var in arr) {     var item = arr[i];      console.log(item); }  console.log(arr["akhaber"]); 

output:

test0 test1 test0 

Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -