2 ms·
One thing I would fix about JavaScript is that currently "return" followed by a newline returns undefined. I would say that only return followed by ';' should
by galaxyLogic 7y ago
One thing I would fix about JavaScript is that currently "return" followed by a newline returns undefined. I would say that only return followed by ';' should return undefined. Else it should return the value of the expression following "return", whether on the same line or not, until the next ";".
Not sure how how much backwards compatibility this would break, but at some point we must allow for newer better less error-prone versions of the language to co-exist in different modules. That is not difficult at all. Consider the case of "use strict"; which does just such a thing. We could have "use strict 2020" etc.