var s = "Main String";
s.startsWith("Main");
Replacing startWith with a similar logic or any other method generic to all browsers.
A good replacement for startsWith
would be using s.substring(0, 4) == 'Main'
This should work, so go ahead and try it.
Add a prototype method in String:
String.prototype.myStartsWith = function(str){
if(this.indexOf(str)===0){
return true;
}else{
return false;
}
};
Now call:
s.myStartsWith("Main");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With