How to check if a string "StartsWith" another string?
You can use ECMAScript 6's String.prototype.startsWith() method. It's supported in all major browsers. However, if you want to use it in a browser that is unsupported you'll want to use a shim/polyfill to add it on those browsers. Creating an implementation that complies with all the details laid out in the spec is a little complicated. If you want a faithful shim, use either:
1. Matthias Bynens's String.prototype.startsWith shim, or
2. The es6-shim, which shims as much of the ES6 spec as possible, including String.prototype.startsWith.
Once you've shimmed the method (or if you're only supporting browsers and JavaScript engines that already have it) ⬇️
☕ Buy me a Coffee at : https://www.buymeacoffee.com/fahadalijjj