From 0c29b1ca0dbac5a8e1a8200dd69561ffb6b2d30a Mon Sep 17 00:00:00 2001 From: Vitalii Fedorenko Date: Thu, 13 Feb 2014 20:37:46 -0500 Subject: [PATCH 1/2] Corrected singleton pattern --- design-patterns/singleton.html | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/design-patterns/singleton.html b/design-patterns/singleton.html index 36555d2..24b0d51 100644 --- a/design-patterns/singleton.html +++ b/design-patterns/singleton.html @@ -111,14 +111,12 @@ // linked to the objects uni.nothing; // true uni2.nothing; // true - uni.everything; // undefined - uni2.everything; // undefined + uni.everything; // true + uni2.everything; // true // that sounds right: uni.constructor.name; // "Universe" - - // but that's odd: - uni.constructor === Universe; // false + uni.constructor === Universe; // true var Universe; @@ -145,4 +143,4 @@ // http://shop.oreilly.com/product/9780596806767.do?sortby=publicationDate - \ No newline at end of file + From e50d6e9843393bae52b2de555864f58a30307447 Mon Sep 17 00:00:00 2001 From: Vitalii Fedorenko Date: Sat, 15 Feb 2014 15:43:05 -0500 Subject: [PATCH 2/2] Fixed while condition --- design-patterns/iterator.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/design-patterns/iterator.html b/design-patterns/iterator.html index b82b4bf..330fb7c 100644 --- a/design-patterns/iterator.html +++ b/design-patterns/iterator.html @@ -11,7 +11,7 @@ */ var element; - while (element - agg.next()) { + while (element = agg.next()) { // do something with the element console.log(element); } @@ -68,4 +68,4 @@ // http://shop.oreilly.com/product/9780596806767.do?sortby=publicationDate - \ No newline at end of file +