I literally pull my hair out on this ...
Here is the situation. I have two javascript lines:
dsName = "Test 1"
replacementString = "Test "
I am trying to check if dsName is started with replacement String with the following code:
if(dsName.indexOf(replacementString) == 0)
{
}
indexOf returns -1 !! How is this possible? I can put a breakpoint in the debugging Chrome script right before this line and paste in the console "dsName.indexOf (replacementString)" and see that it really returns -1.
Now just to prove that I'm not crazy, I can print dsName from the same breakpoint, and it is actually βTest 1β, and replacementString is βTestβ. Here is the actual screenshot from the Chrome debugging console:

, , , , , , . String (replaceString) replaceString.toString(), , , , .
, indexOf , .
, - , ? Chrome?