@@ -120,7 +120,7 @@ saveCityState(cityStateRegex.match(cityStateRegex)[1], cityStateRegex.match(city
120
120
** Good** :
121
121
``` javascript
122
122
const cityStateRegex = / ^ (. + )[,\\ s] + (. +? )\s * (\d {5} )? $ / ;
123
- const match = cityStateRegex .match (cityStateRegex)
123
+ const match = cityStateRegex .match (cityStateRegex);
124
124
const city = match[1 ];
125
125
const state = match[2 ];
126
126
saveCityState (city, state);
@@ -206,7 +206,7 @@ function createMicrobrewery(name) {
206
206
** Good** :
207
207
``` javascript
208
208
function createMicrobrewery (name ) {
209
- var breweryName = name || ' Hipster Brew Co.'
209
+ var breweryName = name || ' Hipster Brew Co.' ;
210
210
}
211
211
```
212
212
** [ ⬆ back to top] ( #table-of-contents ) **
@@ -242,7 +242,7 @@ var menuConfig = {
242
242
body: ' Bar' ,
243
243
buttonText: ' Baz' ,
244
244
cancellable: true
245
- }
245
+ };
246
246
247
247
function createMenu (menuConfig ) {
248
248
...
@@ -334,7 +334,7 @@ function parseBetterJSAlternative(code) {
334
334
REGEXES .forEach ((REGEX ) => {
335
335
statements .forEach ((statement ) => {
336
336
// ...
337
- })
337
+ });
338
338
});
339
339
340
340
let ast;
@@ -344,7 +344,7 @@ function parseBetterJSAlternative(code) {
344
344
345
345
ast .forEach ((node ) => {
346
346
// parse...
347
- })
347
+ });
348
348
}
349
349
```
350
350
@@ -360,7 +360,7 @@ function tokenize(code) {
360
360
REGEXES .forEach ((REGEX ) => {
361
361
statements .forEach ((statement ) => {
362
362
// ...
363
- })
363
+ });
364
364
});
365
365
366
366
return tokens;
@@ -380,7 +380,7 @@ function parseBetterJSAlternative(code) {
380
380
let ast = lexer (tokens);
381
381
ast .forEach ((node ) => {
382
382
// parse...
383
- })
383
+ });
384
384
}
385
385
```
386
386
** [ ⬆ back to top] ( #table-of-contents ) **
@@ -479,12 +479,12 @@ var menuConfig = {
479
479
body: ' Bar' ,
480
480
buttonText: null ,
481
481
cancellable: true
482
- }
482
+ };
483
483
484
484
function createMenu (config ) {
485
- config .title = config .title || ' Foo'
486
- config .body = config .body || ' Bar'
487
- config .buttonText = config .buttonText || ' Baz'
485
+ config .title = config .title || ' Foo' ;
486
+ config .body = config .body || ' Bar' ;
487
+ config .buttonText = config .buttonText || ' Baz' ;
488
488
config .cancellable = config .cancellable === undefined ? config .cancellable : true ;
489
489
490
490
}
@@ -499,7 +499,7 @@ var menuConfig = {
499
499
// User did not include 'body' key
500
500
buttonText: ' Send' ,
501
501
cancellable: true
502
- }
502
+ };
503
503
504
504
function createMenu (config ) {
505
505
config = Object .assign ({
@@ -581,7 +581,7 @@ function splitIntoFirstAndLastName(name) {
581
581
return name .split (' ' );
582
582
}
583
583
584
- var name = ' Ryan McDermott'
584
+ var name = ' Ryan McDermott' ;
585
585
var newName = splitIntoFirstAndLastName (name);
586
586
587
587
console .log (name); // 'Ryan McDermott';
@@ -979,11 +979,11 @@ This can be accomplished through closures (for ES5 and below).
979
979
980
980
var Employee = function (name ) {
981
981
this .name = name;
982
- }
982
+ };
983
983
984
984
Employee .prototype .getName = function () {
985
985
return this .name ;
986
- }
986
+ };
987
987
988
988
var employee = new Employee (' John Doe' );
989
989
console .log (' Employee name: ' + employee .getName ()); // Employee name: John Doe
@@ -1057,7 +1057,7 @@ class UserAuth {
1057
1057
class UserSettings {
1058
1058
constructor (user ) {
1059
1059
this .user = user;
1060
- this .auth = new UserAuth (user)
1060
+ this .auth = new UserAuth (user);
1061
1061
}
1062
1062
1063
1063
changeSettings (settings ) {
@@ -1176,7 +1176,7 @@ function renderLargeRectangles(rectangles) {
1176
1176
rectangle .setHeight (5 );
1177
1177
let area = rectangle .getArea (); // BAD: Will return 25 for Square. Should be 20.
1178
1178
rectangle .render (area);
1179
- })
1179
+ });
1180
1180
}
1181
1181
1182
1182
let rectangles = [new Rectangle (), new Rectangle (), new Square ()];
@@ -1244,7 +1244,7 @@ function renderLargeShapes(shapes) {
1244
1244
1245
1245
let area = shape .getArea ();
1246
1246
shape .render (area);
1247
- })
1247
+ });
1248
1248
}
1249
1249
1250
1250
let shapes = [new Rectangle (), new Rectangle (), new Square ()];
@@ -1732,9 +1732,9 @@ require('request').get('https://en.wikipedia.org/wiki/Robert_Cecil_Martin', func
1732
1732
} else {
1733
1733
console .log (' File written' );
1734
1734
}
1735
- })
1735
+ });
1736
1736
}
1737
- })
1737
+ });
1738
1738
1739
1739
```
1740
1740
@@ -1749,7 +1749,7 @@ require('request-promise').get('https://en.wikipedia.org/wiki/Robert_Cecil_Marti
1749
1749
})
1750
1750
.catch (function (err ) {
1751
1751
console .error (err);
1752
- })
1752
+ });
1753
1753
1754
1754
```
1755
1755
** [ ⬆ back to top] ( #table-of-contents ) **
@@ -1772,15 +1772,15 @@ require('request-promise').get('https://en.wikipedia.org/wiki/Robert_Cecil_Marti
1772
1772
})
1773
1773
.catch (function (err ) {
1774
1774
console .error (err);
1775
- })
1775
+ });
1776
1776
1777
1777
```
1778
1778
1779
1779
** Good** :
1780
1780
``` javascript
1781
1781
async function getCleanCodeArticle () {
1782
1782
try {
1783
- var request = await require (' request-promise' )
1783
+ var request = await require (' request-promise' );
1784
1784
var response = await request .get (' https://en.wikipedia.org/wiki/Robert_Cecil_Martin' );
1785
1785
var fileHandle = await require (' fs-promise' );
1786
1786
@@ -2104,7 +2104,7 @@ let $scope.model = {
2104
2104
// //////////////////////////////////////////////////////////////////////////////
2105
2105
let actions = function () {
2106
2106
// ...
2107
- }
2107
+ };
2108
2108
```
2109
2109
2110
2110
** Good** :
@@ -2116,7 +2116,7 @@ let $scope.model = {
2116
2116
2117
2117
let actions = function () {
2118
2118
// ...
2119
- }
2119
+ };
2120
2120
```
2121
2121
** [ ⬆ back to top] ( #table-of-contents ) **
2122
2122
0 commit comments