I think Javascript is trying to kill me. Errors that would be caught by a compiler in any statically-typed language including FORTRAN, or turn into a run-time exception in any decent dynamically-typed language are swallowed silently by Javascript, patiently waiting to manifest as a bug elsewhere.
Whenever we write Frontend code (nowadays with Angular), we spend most of our time hunting down mistakes such as writing $scope.result = data.results
instead of data.result
. While some tools help, it still requires an astonishing amount of work.
Is there a way to cause the Javascript environment (in a browser) to log a warning whenever someone tries to read a non-existing object property? I don't want to change the language's semantics - accessing data.results
should still returned undefined
, I just want to see a warning on the console saying "Non-existing property accessed, file ... line ...".