SyntaxFix
Write A Post
Hire A Developer
Questions
I just wanted to add my opinion about this.
I think we can just use like this:
var haystack = 'hello world'; var needle = 'he'; if (haystack.indexOf(needle) == 0) { // Code if string starts with this substring }