cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Invisible JS Error: "Invalid left-hand side of assignment"

serged76
Making moves

Looks like I've found sad  UX error for Firefox developer edition. That is, in my JS I say

document.querySelector(".js-born-free")?.style.visibility = "visible";

This should yield common error like "Invalid left-hand side in assignment". But FF says that module cannot be instantiated at runtime and  silent completely about the reason, which is mistake itself.

This at least makes it hard to find and debug the JS error, leading to waste of developer's time.

In the same Chrome (my current is128.0.6613.120 (Official Build) (arm64)), it says (in developer-friendly manner):

XXXXXXXX.js?v=stizfgdtfct32jXo_cLTq0V16QCINiIIheedeFjRTKA:164 Uncaught SyntaxError: Invalid left-hand side in assignment (at XXXXXXXX.js?v=stizfgdtfct32jXo_cLTq0V16QCINiIIheedeFjRTKA:164:9)

1 REPLY 1

davidwarner1
Making moves

Firefox should definitely provide a clearer syntax error message here instead of a vague module instantiation failure. Better debugging feedback saves developers a lot of time when tracking JavaScript issues. Even students working on coding projects or aiou assignment tasks can get confused by such unclear errors.