I've been a professional C, Perl, PHP and Python developer.
I'm an ex-sysadmin from the late 20th century.
These days I do more Javascript and CSS and whatnot, and promote UX and accessibility.
I was looking at these the other day and think they're a disaster waiting to happen. Why do they let you try to change things you can't change without throwing an exception? When trying to reassing a const does?
MDN says
Attempting to delete or add properties to a sealed object, or to convert a data property to accessor or vice versa, will fail, either silently or by throwing a TypeError (most commonly, although not exclusively, when in strict mode code).
Which is just about as vague as you can get. It's, "do this, and that might happen. YOLO."
How’s it going, I'm a Adam, a Full-Stack Engineer, actively searching for work. I'm all about JavaScript. And Frontend but don't let that fool you - I've also got some serious Backend skills.
Location
City of Bath, UK 🇬🇧
Education
10 plus years* active enterprise development experience and a Fine art degree 🎨
It means if you don't use strict mode it will fail silently but as most transpiler tools will allow the option to compile in strict mode it's just a Boolean away. Or you can just add strict mode yourself. Then catching exceptions becomes a useful idea in JavaScript.
Yeah! I even just wrote an article exploring how strict mode affects Freeze-ing objects and calling functions and stuff, since I just barely had to dive into it. dev.to/frehner/exploring-javascrip... Hope it helps :)
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I was looking at these the other day and think they're a disaster waiting to happen. Why do they let you try to change things you can't change without throwing an exception? When trying to reassing a
const
does?MDN says
Which is just about as vague as you can get. It's, "do this, and that might happen. YOLO."
It means if you don't use strict mode it will fail silently but as most transpiler tools will allow the option to compile in strict mode it's just a Boolean away. Or you can just add strict mode yourself. Then catching exceptions becomes a useful idea in JavaScript.
Yeah! I even just wrote an article exploring how strict mode affects Freeze-ing objects and calling functions and stuff, since I just barely had to dive into it. dev.to/frehner/exploring-javascrip... Hope it helps :)