From 9148d08b65bb245e3dea8bea9c7582944aaf7357 Mon Sep 17 00:00:00 2001 From: Sandra Date: Thu, 14 Aug 2025 16:32:29 +0200 Subject: [PATCH 1/6] complete task 01 --- 01/app.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/01/app.js b/01/app.js index e69de29..5671155 100644 --- a/01/app.js +++ b/01/app.js @@ -0,0 +1,8 @@ +const user = { + firstName: 'Sandra', + lastName: 'Mstowska', + sex: 'woman', + age: 26, +} + +console.log(user.firstName, user.lastName, user.sex, user.age); \ No newline at end of file From 2dae61eb5d3d29cfbe6af953e5922458ea570221 Mon Sep 17 00:00:00 2001 From: Sandra Date: Thu, 14 Aug 2025 16:43:01 +0200 Subject: [PATCH 2/6] complete task 02 --- 02/app.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/02/app.js b/02/app.js index a70d947..62cd18a 100644 --- a/02/app.js +++ b/02/app.js @@ -8,4 +8,13 @@ const calendarJS = { 'ES7': '2016-06', 'ES8': '2017-06', 'ES9': '2018-06', +} + + +for(const key in calendarJS) { + if((calendarJS[key]) === null) { + console.log(key, "nie zostało wydane"); + } else { + console.log(key, "wydano w terminie", (calendarJS[key])); + } } \ No newline at end of file From 884772776be2b4dbde41491d0bbdcfd05b1ed274 Mon Sep 17 00:00:00 2001 From: Sandra Date: Thu, 14 Aug 2025 17:17:39 +0200 Subject: [PATCH 3/6] complete task 03 --- 03/app.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/03/app.js b/03/app.js index 3ab7c52..2ab7abc 100644 --- a/03/app.js +++ b/03/app.js @@ -42,14 +42,26 @@ books.getAuthor = function(isbn) { } books.getTitle = function(isbn, lang) { + if(typeof this[isbn] === 'undefined') { + return null; + } + const title =this[isbn].title; + return lang === 'en' ? title.en : title.pl; } books.getTranslator = function(isbn, lang) { + if(typeof this[isbn] === 'undefined') { + return null; + } + const translator = this[isbn].translator; + const result = translator[lang]; + return result === null ? false : result; } + console.log( books.getAuthor('978-83-7278-000-3') ); // J.K. Rowling console.log( books.getAuthor('000-00-0000-000-0') ); // null console.log( books.getTitle('978-83-7278-000-3', 'pl') ); // Harry Potter i Kamień Filozoficzny From 827a5f3dff8b6e87c2112134a672b0caffa3172e Mon Sep 17 00:00:00 2001 From: Sandra Date: Mon, 18 Aug 2025 11:05:49 +0200 Subject: [PATCH 4/6] complete task 04- complete all tasks --- 04/app.js | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/04/app.js b/04/app.js index 1090571..f4af0e1 100644 --- a/04/app.js +++ b/04/app.js @@ -2,8 +2,22 @@ const user = { firstName: 'Adam', lastName: 'Nowak', born: { - day: '14', - month: '04', + day: '18', + month: '08', year: '1985' } -} \ No newline at end of file +} + +function happyBday(user) { + const today = new Date(); + const day = today.getDate(); + const month = today.getMonth() + 1; + + if (day == user.born.day && month == user.born.month) { + return "Today is your birthday!"; + } else { + return "Today is not your birthday :c"; + } +} + +console.log(happyBday(user)); \ No newline at end of file From 38a7534992ea37eababe2916bb4d4ce8fd6a2013 Mon Sep 17 00:00:00 2001 From: Sandra Date: Tue, 19 Aug 2025 12:06:28 +0200 Subject: [PATCH 5/6] fix small bugs in tasks 02 and 03 --- 02/app.js | 4 ++-- 03/app.js | 12 +++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/02/app.js b/02/app.js index 62cd18a..f039f67 100644 --- a/02/app.js +++ b/02/app.js @@ -12,9 +12,9 @@ const calendarJS = { for(const key in calendarJS) { - if((calendarJS[key]) === null) { + if(calendarJS[key] === null) { console.log(key, "nie zostało wydane"); } else { - console.log(key, "wydano w terminie", (calendarJS[key])); + console.log(key, "wydano w terminie", calendarJS[key]); } } \ No newline at end of file diff --git a/03/app.js b/03/app.js index 2ab7abc..a351d1e 100644 --- a/03/app.js +++ b/03/app.js @@ -47,7 +47,9 @@ books.getTitle = function(isbn, lang) { } const title =this[isbn].title; - return lang === 'en' ? title.en : title.pl; + if(typeof title[lang] !== 'undefined') { + return title[lang]; + } } books.getTranslator = function(isbn, lang) { @@ -56,8 +58,12 @@ books.getTranslator = function(isbn, lang) { } const translator = this[isbn].translator; - const result = translator[lang]; - return result === null ? false : result; + + if(typeof translator[lang] === 'undefined') { + return false; + } + + return translator[lang] === null ? false : translator[lang]; } From 43f1b4f72e6dfaee37b931f7da8cbb94cf7d601c Mon Sep 17 00:00:00 2001 From: Sandra Date: Wed, 20 Aug 2025 10:57:46 +0200 Subject: [PATCH 6/6] add const result for safety --- 03/app.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/03/app.js b/03/app.js index a351d1e..4d5b4bd 100644 --- a/03/app.js +++ b/03/app.js @@ -59,11 +59,12 @@ books.getTranslator = function(isbn, lang) { const translator = this[isbn].translator; - if(typeof translator[lang] === 'undefined') { + const result = translator[lang]; + if(result === 'undefined') { return false; } - return translator[lang] === null ? false : translator[lang]; + return result === null ? false : translator[lang]; }