Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
The world of bugs
Bugs are flows in our programs that we ourselves introduce. They are introduced either by mistakes or simply by confusion. When the brain fails to align with the flow of the program, bugs are introduced.
Loosely types JS
If computers knew our intent, it would surely be easy for it to help us, unfortunately JS, with it’s weak typing system, it makes it even hard to catch things before hands that are complete bogus.
JavaScript is designed in a way that, things that do not align with the program’s grammar, will be flagged before hand (typo here and there), while other things such as calling a non functional variable or accessing a nested non existing property from will be flagged only when it’s being executed (compile time)
Codes that fail in such a way that they do not produce an error but rather an incorrect output, are quite hard to debug and reason about.
Strict mode
Strict mode is a feature that was introduced to prevent people from writing codes in a fashion that align with JS specification. It prevent you from using variables before defining them (which is something nobody should to in the first place), creating variables without being explicit about their keyword (especially in a for lot), or simply default the this to undefined if called on a function.
Strict mode is designed to catch some antipattern in JS that are very likely to lead to a bug or an unpredictable behavior.