Being a JavaScript developer can be an exciting job. Almost every day you will find something mysterious and otherworldly. Sometimes that's a magic...
For further actions, you may consider blocking this person and/or reporting abuse
An example of the one use case I can think of is for simple templating. For example Underscore uses it on the
template()
function which can be called from modern JS:underscorejs.org/docs/underscore-e...
Personally I've used it only 1 time I remember after doing JS for 20+ years and it was to create a templating feature for Web Components.
Pascal has a
with ... do ...
statement, which behaves in the same way as in JS.I've used it on a project where we created an in browser ide for days analysis. You would configure an object with properties for pluggable builtins, then surround the user's code in a with statement and emit it into a sandbox iframe.
Wow, this sounds absolutely horrible from today's point of view 😅 I wonder what the original idea behind it was. I mean what made the devs think something like this would be necessary or improve the language?
I always liked with :D... how about labels? I remember being weirded out the first time I saw them: developer.mozilla.org/en-US/docs/W...
The only time that I've used this is when in the node console where you can run
with(process) { exit() }, but .exit is definitely a better way to exit
Or let's make it process?.exit(), then you can use it anywhere :-)
You have a good sense of humour :D. Nicely written article.
I saw this in a c# codebase a few days ago.
Funny how it's usage is similar
This bring back so much memory when i was young and messing around with vb.net.
If only JS
with
worked like the vb.net it would be much more useful and no accidental shadowing :)"If you use the with keyword, everyone will think you are crazy and avoid you in the lunch room. Or maybe they will just look at you funny."
As they should.