Alternative Methods for Checking if a String Starts With Another String in JavaScript
Using the startsWith() method:The startsWith() method is directly built into JavaScript strings.It takes one or two arguments:The first argument is the substring you want to check for at the beginning of the main string