From 9c46faf2155a4dd6465bffd91ed7ca57451f7c90 Mon Sep 17 00:00:00 2001 From: ironmaniiith Date: Fri, 11 Nov 2016 09:04:40 +0530 Subject: [PATCH 1/2] Minor typos fix --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fd68472..d5f08f3 100644 --- a/README.md +++ b/README.md @@ -86,13 +86,13 @@ var Employee = function (name, company, salary) { this.salary = salary || 5000; //Public attribute default value is null // Private method - var increaseSlary = function () { + var increaseSalary = function () { this.salary = this.salary + 1000; }; // Public method this.dispalyIncreasedSalary = function() { - increaseSlary(); + increaseSalary(); console.log(this.salary); }; }; From 24ef14bac5a6f354abd0ada57a13a73a84643ac8 Mon Sep 17 00:00:00 2001 From: ironmaniiith Date: Fri, 11 Nov 2016 17:02:47 +0530 Subject: [PATCH 2/2] Corrected minor mistake in section 4 removing the actual code out of comments --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fd68472..7512c15 100644 --- a/README.md +++ b/README.md @@ -137,8 +137,10 @@ var globalVar = "abc"; "innerArg = " + innerArg + "\n" + "innerFuncVar = " + innerFuncVar + "\n" + "globalVar = " + globalVar); - } // end of scope innerFunction)(5); // Pass 5 as parameter -} // end of scope outerFunction )(7); // Pass 7 as parameter + // end of scope innerFunction + })(5); // Pass 5 as parameter +// end of scope outerFunction +})(7); // Pass 7 as parameter ``` `innerFunction` is closure which is defined inside `outerFunction` and has access to all variable which is declared and defined in outerFunction scope. In addition to this function defined inside function as closure has access to variable which is declared in `global namespace`.