From 9f1ffbc59cf723851fb7210b8e237bf39ee69470 Mon Sep 17 00:00:00 2001 From: Jonas Schmedtmann Date: Tue, 19 Jan 2021 15:09:53 +0000 Subject: [PATCH] Fixed some small bugs --- 12-Numbers-Dates-Timers-Bankist/final/script.js | 6 +++++- 14-OOP/final/script.js | 11 +++++++---- 16-Asynchronous/final/script.js | 7 ++++++- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/12-Numbers-Dates-Timers-Bankist/final/script.js b/12-Numbers-Dates-Timers-Bankist/final/script.js index df64cbffa3..12b62b7400 100644 --- a/12-Numbers-Dates-Timers-Bankist/final/script.js +++ b/12-Numbers-Dates-Timers-Bankist/final/script.js @@ -357,7 +357,11 @@ btnClose.addEventListener('click', function (e) { let sorted = false; btnSort.addEventListener('click', function (e) { e.preventDefault(); - displayMovements(currentAccount.movements, !sorted); + // BUG in video: + // displayMovements(currentAccount.movements, !sorted); + + // FIX: + displayMovements(currentAccount, !sorted); sorted = !sorted; }); diff --git a/14-OOP/final/script.js b/14-OOP/final/script.js index ca569b44d8..15fe863919 100644 --- a/14-OOP/final/script.js +++ b/14-OOP/final/script.js @@ -182,7 +182,7 @@ console.log(jessica.__proto__ === PersonCl.prototype); jessica.greet(); // 1. Classes are NOT hoisted -// 2. Classes are first-class citizes +// 2. Classes are first-class citizens // 3. Classes are executed in strict mode const walter = new PersonCl('Walter White', 1965); @@ -468,11 +468,15 @@ StudentProto.init = function (firstName, birthYear, course) { }; StudentProto.introduce = function () { - console.log(`My name is ${this.fullName} and I study ${this.course}`); + // BUG in video: + // console.log(`My name is ${this.fullName} and I study ${this.course}`); + + // FIX: + console.log(`My name is ${this.firstName} and I study ${this.course}`); }; const jay = Object.create(StudentProto); -jay.init('Jay', 2010, 'Compuetr Science'); +jay.init('Jay', 2010, 'Computer Science'); jay.introduce(); jay.calcAge(); @@ -644,4 +648,3 @@ rivian console.log(rivian.speedUS); */ - diff --git a/16-Asynchronous/final/script.js b/16-Asynchronous/final/script.js index cdc1efd230..2dbf6adba1 100644 --- a/16-Asynchronous/final/script.js +++ b/16-Asynchronous/final/script.js @@ -481,7 +481,12 @@ const whereAmI = async function () { const res = await fetch( `https://restcountries.eu/rest/v2/name/${dataGeo.country}` ); - if (!resGeo.ok) throw new Error('Problem getting country'); + + // BUG in video: + // if (!resGeo.ok) throw new Error('Problem getting country'); + + // FIX: + if (!res.ok) throw new Error('Problem getting country'); const data = await res.json(); console.log(data);