From 1b10c359bfac9041a2f3db503f044236b8b5ae11 Mon Sep 17 00:00:00 2001 From: Tom Byrer Date: Wed, 29 Nov 2017 04:32:43 -0600 Subject: [PATCH] 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-js/06-advanced-functions/07-new-function/article.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/1-js/06-advanced-functions/07-new-function/article.md b/1-js/06-advanced-functions/07-new-function/article.md index 73805745..b9d6d1ca 100644 --- a/1-js/06-advanced-functions/07-new-function/article.md +++ b/1-js/06-advanced-functions/07-new-function/article.md @@ -109,7 +109,7 @@ The "sum" function actually does that right: ```js run *!* -let sum = new Function('a', 'b', ' return a + b; '); +let sum = new Function('a', 'b', 'return a + b'); */!* let a = 1, b = 2; @@ -133,9 +133,9 @@ For historical reasons, arguments can also be given as a comma-separated list. These three mean the same: ```js -new Function('a', 'b', ' return a + b; '); // basic syntax -new Function('a,b', ' return a + b; '); // comma-separated -new Function('a , b', ' return a + b; '); // comma-separated with spaces +new Function('a', 'b', 'return a + b'); // basic syntax +new Function('a,b', 'return a + b'); // comma-separated +new Function('a , b', 'return a + b'); // comma-separated with spaces ``` 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.