3 ms·
There are some weird corners of JavaScript that I went years without knowing. Did you know object literals support getter and setter methods[1]? As other comme
by zachrose 8y ago
There are some weird corners of JavaScript that I went years without knowing. Did you know object literals support getter and setter methods[1]?
As other commenters will point out, such quirks are as easy to look up as they are irrelevant to actual software development.
[1] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Working_with_Objects https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guid... "Defining getters and setters"
- vanillapepsi 8y agoSo why would you ask them?
- dlbucci 8y agoGod, I used to go nuts with defineProperty and such back in the day. Kind of a bummer that it's even easier to do with ES6, cause that code was usually bad news.