From 1b87b89f2bb247dadb25568af14af4db36e61f21 Mon Sep 17 00:00:00 2001 From: Samuel Braun Date: Sun, 25 Sep 2022 14:59:06 +0200 Subject: [PATCH] Omitting parentheses after `new` Parentheses can be omitted even if the constructor function has arguments: ```js new function(test) { return { test } } // Works the same as new (function(test) { return { test } })(); ``` --- 1-js/04-object-basics/06-constructor-new/article.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-js/04-object-basics/06-constructor-new/article.md b/1-js/04-object-basics/06-constructor-new/article.md index f3e9c3ec..a335464f 100644 --- a/1-js/04-object-basics/06-constructor-new/article.md +++ b/1-js/04-object-basics/06-constructor-new/article.md @@ -171,7 +171,7 @@ alert( new SmallUser().name ); // John Usually constructors don't have a `return` statement. Here we mention the special behavior with returning objects mainly for the sake of completeness. ````smart header="Omitting parentheses" -By the way, we can omit parentheses after `new`, if it has no arguments: +By the way, we can omit parentheses after `new`: ```js let user = new User; // <-- no parentheses