-
Notifications
You must be signed in to change notification settings - Fork 26.8k
Closed
iamstoick/javascript
#3Description
At the bottom of the variables section, this code example is given:
// bad
function() {
var name = getName();
if (!arguments.length) {
return false;
}
return true;
}
// good
function() {
if (!arguments.length) {
return false;
}
var name = getName();
return true;
}
At the top of that code block it says:
Assign variables at the top of their scope. This helps avoid issues with variable declaration and assignment hoisting related issues.
It's not clear what point the code example is trying to make, as it doesn't reflect the statement made in that comment. Plus, the name variable is defined but never used.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels