From 58f9e1bcb94f1fa29adc62e78d263d3651e0ee5a Mon Sep 17 00:00:00 2001 From: Akshar Chaklashiya Date: Thu, 22 Sep 2022 23:05:58 -0400 Subject: [PATCH] Fixed typo error and updated some comment which was incorrect. --- README.md | 10 +++++----- es2015/15.map.js | 2 +- es2015/19.proxies.js | 4 ++-- es2015/4.enhanced-object-literals.js | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 2e79e34..6350dd5 100644 --- a/README.md +++ b/README.md @@ -306,7 +306,7 @@ Each proposal for an ECMAScript feature goes through the following maturity stag multiply: function(a, b) { return a * b; } }; - console.log(calculation.add(5, 3)); // 8 + console.log(calculation.sum(5, 3)); // 8 console.log(calculation.multiply(5, 3)); // 15 ``` @@ -318,7 +318,7 @@ Each proposal for an ECMAScript feature goes through the following maturity stag multiply(a, b) { return a * b; } }; - console.log(calculation.add(5, 3)); // 8 + console.log(calculation.sum(5, 3)); // 8 console.log(calculation.multiply(5, 3)); // 15 ``` @@ -844,7 +844,7 @@ Each proposal for an ECMAScript feature goes through the following maturity stag const user = new Proxy(target, handler); console.log(user.name); // John - console.log(user.age); // John + console.log(user.age); // 3 console.log(user.gender); // gender does not exist ``` @@ -868,7 +868,7 @@ Each proposal for an ECMAScript feature goes through the following maturity stag } }; - const person = new Proxy({}, validator); + const person = new Proxy({}, ageValidator); person.age = 30; console.log(person.age); // 30 @@ -1571,7 +1571,7 @@ Each proposal for an ECMAScript feature goes through the following maturity stag ```js const obj = {'a': '1', 'b': '2', 'c': '3' }; const arr = Object.entries(obj); - console.log(obj); // [ ['a', '1'], ['b', '2'], ['c', '3'] ] + console.log(arr); // [ ['a', '1'], ['b', '2'], ['c', '3'] ] ``` But if you want to get the object back from an array then you need iterate and convert it as below, diff --git a/es2015/15.map.js b/es2015/15.map.js index 095051d..34007d9 100644 --- a/es2015/15.map.js +++ b/es2015/15.map.js @@ -13,7 +13,7 @@ console.log(typeMap.get('10') ); // string console.log(typeMap.get(keyObj)) // object console.log(typeMap.get({'one': 1})) // undefined -console.log(typeMap.size ); // 3 +console.log(typeMap.size ); // 4 for(let item of typeMap) { console.log(item); diff --git a/es2015/19.proxies.js b/es2015/19.proxies.js index 233ffad..a3b6aa9 100644 --- a/es2015/19.proxies.js +++ b/es2015/19.proxies.js @@ -13,7 +13,7 @@ const handler = { const user = new Proxy(target, handler); console.log(user.name); // John - console.log(user.age); // John + console.log(user.age); // 3 console.log(user.gender); // gender does not exist // validations @@ -35,7 +35,7 @@ let ageValidator = { } }; -const person = new Proxy({}, validator); +const person = new Proxy({}, ageValidator); person.age = 30; console.log(person.age); // 30 diff --git a/es2015/4.enhanced-object-literals.js b/es2015/4.enhanced-object-literals.js index d37f49d..76e95e6 100644 --- a/es2015/4.enhanced-object-literals.js +++ b/es2015/4.enhanced-object-literals.js @@ -13,7 +13,7 @@ var calculation = { multiply(a, b) { return a * b; } }; -console.log( calculation.add(5, 3) ); // 15 +console.log( calculation.sum(5, 3) ); // 15 console.log( calculation.multiply(5, 3) ); // 15 // Computed Property Names