Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 14 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1102,45 +1102,36 @@ Other Style Guides
> Why? `let` and `const` are block scoped and not function scoped.

```javascript
// good
function () {
test();
console.log('doing stuff..');

//..other stuff..

// bad - unnecessary function call
function checkName(hasName) {
const name = getName();

if (name === 'test') {
if (hasName === 'test') {
return false;
}

return name;
}

// bad - unnecessary function call
function (hasName) {
const name = getName();

if (!hasName) {
if (name === 'test') {
this.setName('');
return false;
}

this.setFirstName(name);

return true;
return name;
}

// good
function (hasName) {
if (!hasName) {
function checkName(hasName) {
if (hasName === 'test') {
return false;
}

const name = getName();
this.setFirstName(name);

return true;
if (name === 'test') {
this.setName('');
return false;
}

return name;
}
```

Expand Down