...

View Full Version : put literal string as elements to array



BubikolRamios
06-11-2008, 10:45 PM
// this works
a = new array("1","2")

// this does not, how to do it ?
var s = ""1","2""
a = new array(eval(s));


works like this:


a = eval ("new Array(" + s + ")");


any comments ?

rnd me
06-12-2008, 12:10 AM
a ="1,2,3,4,5,6,7,8,9".split(",")



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum