DEV Community

Discussion on: How can I improve this while loop code snippet?

Collapse
 
alainvanhout profile image
Alain Van Hout

If you simply want the first instance of a certain character, and the context is not more complex, and it doesn't require hyper-optimisation, then just go with source.indexOf(" ")