JavaScript's startsWith method can check if a particular string starts with another string. We could use a conditional statement, but this might get very unorganized. Another way is to use the same method on a predefined array. I quite like the simplicity and naming of this method as it really states what's happening.
Table of contents
Thank you for reading, and let's connect!3 Comments
Sort: