content
content copied to clipboard
Invalid assignment LHS can be a ReferenceError
Description
Some more error cases, and a more complete description of its type.
Motivation
Additional details
Related issues and pull requests
Preview URLs
(comment last updated: 2023-02-21 01:40:25)
I would prefer to keep them on the same page, as the two error messages are tightly connected. Also consider the fact that in strict mode, Firefox also throws a syntax error:
(() => {
"use strict";
function foo() {
return { a: 1 };
}
foo() = 1; // SyntaxError: invalid assignment left-hand side
})();
(() => {
function foo() {
return { a: 1 };
}
foo() = 1; // ReferenceError: cannot assign to function call
})();
Pinging @Elchi3 in case there's some more insight from the Mozilla team?
This pull request has merge conflicts that must be resolved before it can be merged.
This pull request has merge conflicts that must be resolved before it can be merged.
Pinging @Elchi3 in case there's some more insight from the Mozilla team?
I'm not sure if the Firefox Developer Tools team still cares so much about links from error messages. It was a project back when I was at Mozilla. I wrote a blog post about it in 2016: https://hacks.mozilla.org/2016/06/helping-web-developers-with-javascript-errors/
I think this PR can be merged as is. We can have a separate discussion about the general usefulness of this set of docs, though. Maybe we want to make larger changes and if so we could try to find out if and how Firefox still links to MDN (and avoid breaking it, I remember how this helped a lot of people back in the day. We saw a big spike in the MDN traffic numbers for people coming from Firefox developer tools).