Re:10 Weird HTML Hacks That Shaped the Internet
by trealira on Friday December 01, 2023 @02:03PM
(#38490765)
I knew about the Pascal "with", but I didn't know JavaScript had the same construct.
That kind of "with" is a lot less intuitive to me.
I was responding with Python's "with" because it sounded like they were talking about programming languages in general, but now I can see they were obviously talking about JavaScript's "with" given this context.
Javascript with comes from Pascal with (which was perhaps copied from somewhere else) and is used to modify variable scope.
is equivalent to: or at least, it might be ... due to Javascript's dynamic and typeless nature you might not know for sure what will happen until runtime. Which is one reason it's now deprecated and not allowed in strict mode. In pascal, variables have a type, records have fields, and these are known at compile time so that's not an issue.https://wiki.freepascal.org/With
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...