3 ms·
Wow, your use of `with` is both terrifying and super fresh. I love/hate it.
by paulirish 2y ago
Wow, your use of `with` is both terrifying and super fresh. I love/hate it.
- phatskat 2y agoI’ll be honest, I didn’t know JS had `with`…off to MDN
- myfonj 2y agohttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/with https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe... tl;dr is that `with` is a long deprecated statement that is good for casual "golfing" and raising eyebrows of JS-savvy folks. Does not work in the "use strict" mode (so in modules) and generally should not be used in any "real-world" production code, since it prevents many optimisations and could possibly make the code harder to grasp. But I guess for casual one-time console doodles it could be fine. Reportedly it is supported in all major JS engines, and I don't think it will be really removed in foreseeable future.
- phatskat 2y agoI read the MDN page on it right after my comment and it’s fascinating, and also very understandable why it’s a Bad Idea™