Skip to content

Commit 1b10c35

Browse files
authored
consistent code style
First the Function function string had no spaces or trailing semi, then did in the second half. Perhaps a linter bot would be better, but manual will do for now.
1 parent 4b02949 commit 1b10c35

File tree

1 file changed

+4
-4
lines changed
  • 1-js/06-advanced-functions/07-new-function

1 file changed

+4
-4
lines changed

1-js/06-advanced-functions/07-new-function/article.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ The "sum" function actually does that right:
109109

110110
```js run
111111
*!*
112-
let sum = new Function('a', 'b', ' return a + b; ');
112+
let sum = new Function('a', 'b', 'return a + b');
113113
*/!*
114114

115115
let a = 1, b = 2;
@@ -133,9 +133,9 @@ For historical reasons, arguments can also be given as a comma-separated list.
133133
These three mean the same:
134134

135135
```js
136-
new Function('a', 'b', ' return a + b; '); // basic syntax
137-
new Function('a,b', ' return a + b; '); // comma-separated
138-
new Function('a , b', ' return a + b; '); // comma-separated with spaces
136+
new Function('a', 'b', 'return a + b'); // basic syntax
137+
new Function('a,b', 'return a + b'); // comma-separated
138+
new Function('a , b', 'return a + b'); // comma-separated with spaces
139139
```
140140

141141
Functions created with `new Function`, have `[[Environment]]` referencing the global Lexical Environment, not the outer one. Hence, they can not use outer variables. But that's actually good, because it saves us from errors. Explicit parameters passing is a much better thing architecturally and has no problems with minifiers.

0 commit comments

Comments
 (0)