Set.prototype.toggle

Andrea Giammarchi andrea.giammarchi at gmail.com
Sun Oct 29 21:06:21 UTC 2017


> having an API with a boolean argument - which is something that there's
zero precedent in the language

not sure about strictly JS but `classList`, which is a Set of strings, has
a `classList.toggle(name, true)` which does the same.

although I agree this is a not so needed method so it's probably not worth
to have a precedent in the JS side
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20171029/43eef49c/attachment.html>


More information about the es-discuss mailing list