I don’t know what the IE error is- what are you using for input?
It looks like it is not in the form of an rgb triplet.
The function doesn’t work correctly, however, even where it doesn’t make an error.
rgbToHex(‘rgb(255,0,0)’);
/* returned value: (String) #rgb(255,0,0)ff0000
*/
The first index (0) of a non-global match is eveything that matched.
I’m using jquery and set $(this).css(‘backgroundColor’) as input. The function works fine if delete(parts[0]) is uncommented. Not sure why I have it commented in the original post…