I just pulled up the page for String.match, which is a weird function because it returns an array that has named properties on it. W3Schools doesn't mention that. It just says it "method returns an array with the matches." It also doesn't mention the behavior without the global flag. I also noticed a misspelling ("Differense").
Comparing these two pages, only the second one is competent at describing what the function actually does. Neither is perfect. The MDN doesn't do a great job of communicating all the information, but at least all of the information is there.
I think I've been using MDN for 20 years (I don't remember honestly when it first came to be), but it's first time I hear about it. Banner/link blindness is a hell of a thing! Thanks for letting me know.
Tangent: why is .match on Symbol? I read through string.match and looked at Symbol and I don’t understand why all these helpful functions exist on Symbol.
Symbol.match is not the match function, it is a Symbol which can be used as a property key on an object that is supposed to behave like a regular expression.
The purpose of having Symbol values is to ensure the property keys are unique and can't collide with string keys that predate new standards.
Ohhhh okay. So it’s just a flag describing expectations about an object. And as a Symbol it doesn’t interfere with any other part of the object such as properties or iteration.
=> https://www.w3schools.com/jsref/jsref_match.asp
=> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
Comparing these two pages, only the second one is competent at describing what the function actually does. Neither is perfect. The MDN doesn't do a great job of communicating all the information, but at least all of the information is there.