PDA

View Full Version : What do you think of this function?



bandinopla
September 20th, 2005, 03:35 PM
Hi, I made this function:

function xToArray(b){
pol=/(\.)/g
a=eval("\['" + b.replace(pol,"','") + "']")
return a
}
var a="a.b.c.d.e.f.g"
var b=xToArray(a)

Now b is an array...

Ankou
September 20th, 2005, 04:57 PM
JavaScript? Why not just use the split() function?

var a = "a.b.c.d.e.f.g"
var b = a.split('.')

bandinopla
September 21st, 2005, 12:22 PM
:cantlook: I did not know that function !!!!! jajajajajaja... thanks