Advertisement
728x90
You can use ECMAScript 6's String.prototype.startsWith() method to check if a string starts with another string or not. But it is not yet supported in all browsers. Let's see an example to see this usage,
javascript
1"Good morning".startsWith("Good"); // true
2 "Good morning".startsWith("morning"); // falseAdvertisement
Responsive Ad
🎯 Practice NowRelated Challenge
JavaScript Coding Exercise 50
Test your knowledge with this interactive coding challenge.
Start CodingAdvertisement
728x90
134of476