Strings, Arrays and Split in js

I have looked at several posts on strings and am using this in Unity js but it doesn't seem to work. any suggestions? The idea is to have a number show up in speedD.

I have also tried var speedD = int.Parse(arrayz[0]); in the last line to assure it is returned as a number. Any help is appreciated!:)

var speedB = "10,20,30";
var arrayz  = new Array ();
arrayz = speedB.Split("," [0]);
var speedD = arrayz[0];

What exactly doesn't work?

Because copypasting that into a new file works correctly for me and prints 10. (added a print line obviously)

Perhaps you mean you need speedD to be an integer, not a string? You have to cast to integer:

var speedD : int = arrayz[0]