A Quick Guide to the String Match Method in JavaScript

1 · · Jan. 7, 2020, midnight
String.prototype.match() (aka: the match method on strings) can allow you to switch out strings or set conditions if a string or any data is matched. It then stores that data in a new array. First the syntax and then the explanation: let newArray = string.match(condition); Terminology The match() method retrieves the result of matching a string against a regular expression. You can read more about regEx here. Remember, when all conditions are matched, those results will be stored in a new array...