Roy Tang

Programmer, engineer, scientist, critic, gamer, dreamer, and kid-at-heart.

Blog Notes Photos Links Archives About

You already have the lines logging your values array, was it so hard to add lines logging the other vars?

c1_arr = c1.split(';');  

The array created here is [‘font-color:#ff0000’, ‘'] - there is a blank second element since there’s nothing after the ‘;’ in the input string.

Then when you call:

values[1][i]= c1_arr[i].split(':');

c1_arr[1] is empty string, so values[1][1] is an array with only one element, empty string.

values[1][1][0] -> empty string values[1][1][1] -> undefined (no second element)