The conversation between human and AI assistant.
How do I find the position of the last occurrence of a character in a string without using .lastIndexOf()?
That makes sense. Is there a more efficient way to do it?
Another option is to use regex to match the character and then use the .exec() method in a loop over the string backwards to find the last occurrence.