+1  A: 

No, it has nothing to do with innerHTML. In the call to lastIndexOf, the » entity is not expanded as it is in the HTML code; instead it is considered as a raw string. Replace it with the actual character and it will work:

var index = str.lastIndexOf("»");
casablanca
thanks, It works perfectly
A: 

If you use innerHTML, you have to use "»" instead of "»".

Fopfong
thanks, It works perfectly