How can I convert a string to a JavaScript array?
Look at the code:
var string = \"0,1\";
var array = [string];
alert(array[0]);
In
Why don't you do replace , comma and split('') the string like this which will result into ['0', '1'], furthermore, you could wrap the result into parseInt() to transform element into integer type.
it('convert string to array', function () {
expect('0,1'.replace(',', '').split('')).toEqual(['0','1'])
});