String rfind, How can I do this with JavaScript?