The Symbol.match static data property represents the well-known symbol@@match. The String.prototype.match() method looks up this symbol on its first argument for the method used to match an input string against the current object. This symbol is also used to determine if an object should be treated as a regex.
"/bar/".startsWith(/bar/);// Throws TypeError, as /bar/ is a regular expression// and Symbol.match is not modified.
However, if you set Symbol.match to false, the object will be considered as not a regular expression object. The methods startsWith and endsWith won't throw a TypeError as a consequence.
js
const re =/foo/;
re[Symbol.match]=false;"/foo/".startsWith(re);// true"/baz/".endsWith(re);// false