4 ms·
I think I've been unclear. When I say function definition I'm referring to this: function foo() { console.log('bar'); } And when referring to a
by rnd33 13y ago
I think I've been unclear. When I say function definition I'm referring to this:
function foo() {
console.log('bar');
}
And when referring to a function expression I'm talking about this:
var foo = function () {
console.log('bar');
};
The latter needs to be terminated with a semicolon to prevent ambiguity (in some situations), while the former does not. This for example is valid JavaScript:
function foo() {
console.log('bar');
}foo=5
- ivanca 13y agoYeah, that's correct; no discussion on that, and no linter that I have used asks you to put a semicolon in such case.
- deleted 13y ago[deleted]