Hacker News new | past | comments | ask | show | jobs | submit login

Wow, your use of `with` is both terrifying and super fresh. I love/hate it.



I’ll be honest, I didn’t know JS had `with`…off to MDN


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.


I read the MDN page on it right after my comment and it’s fascinating, and also very understandable why it’s a Bad Idea™




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: