From b5137008c86592631affd39bb082209bce85e01e Mon Sep 17 00:00:00 2001 From: hannahwn Date: Wed, 28 Jan 2026 12:57:32 +0100 Subject: [PATCH 01/13] checks if nothing was entered --- task-1/book.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/task-1/book.js b/task-1/book.js index 8b49ecc..20334bf 100644 --- a/task-1/book.js +++ b/task-1/book.js @@ -1,3 +1,6 @@ function isBookApplicable(searchString) { - // Your code here + if (!searchString) { + return false; + } + } From 6bbd0a1c99aed62b51fdc3ee13e6ec639d6632c8 Mon Sep 17 00:00:00 2001 From: hannahwn Date: Wed, 28 Jan 2026 13:02:13 +0100 Subject: [PATCH 02/13] makes everything lowercase --- task-1/book.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/task-1/book.js b/task-1/book.js index 20334bf..bcb66c7 100644 --- a/task-1/book.js +++ b/task-1/book.js @@ -2,5 +2,6 @@ function isBookApplicable(searchString) { if (!searchString) { return false; } - + let cleanedSearch = searchString.trim().toLowerCase(); + } From 50948dcc4a77cde3aa9293834c43a362ecdeae03 Mon Sep 17 00:00:00 2001 From: hannahwn Date: Wed, 28 Jan 2026 13:07:41 +0100 Subject: [PATCH 03/13] checks if title complete --- task-1/book.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/task-1/book.js b/task-1/book.js index bcb66c7..41fdd67 100644 --- a/task-1/book.js +++ b/task-1/book.js @@ -4,4 +4,11 @@ function isBookApplicable(searchString) { } let cleanedSearch = searchString.trim().toLowerCase(); + if (cleanedSearch === "") { + return false; + } + + let bookTitle = "The fundamentals of JavaScript".toLowerCase(); + + let isFound = bookTitle.includes(cleanedSearch); } From 9b5547c514e8992cf46a2399622aa6f3dcd4bea6 Mon Sep 17 00:00:00 2001 From: hannahwn Date: Wed, 28 Jan 2026 13:17:42 +0100 Subject: [PATCH 04/13] tested at the end --- task-1/book.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/task-1/book.js b/task-1/book.js index 41fdd67..a731b3f 100644 --- a/task-1/book.js +++ b/task-1/book.js @@ -11,4 +11,8 @@ function isBookApplicable(searchString) { let bookTitle = "The fundamentals of JavaScript".toLowerCase(); let isFound = bookTitle.includes(cleanedSearch); + + + return isFound; } +console.log(isBookApplicable('python')); \ No newline at end of file From df3eec6f2f57c884a651bb89ae6e8f8436299a3a Mon Sep 17 00:00:00 2001 From: hannahwn Date: Wed, 28 Jan 2026 13:37:29 +0100 Subject: [PATCH 05/13] split input to array --- task-2/parse-date.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/task-2/parse-date.js b/task-2/parse-date.js index 877a3aa..51c7256 100644 --- a/task-2/parse-date.js +++ b/task-2/parse-date.js @@ -1 +1,12 @@ -// Your code here +function parseDateString(dateString) { + let parts = dateString.split(""); + + let format =parts[0]; + let datePart = parts[1]; + + + let numbers = datePart.split("-"); + + + ) +} \ No newline at end of file From f417101f51303407ba4ee2fa9428a9c665186c25 Mon Sep 17 00:00:00 2001 From: hannahwn Date: Wed, 28 Jan 2026 13:51:36 +0100 Subject: [PATCH 06/13] checks the format --- task-2/parse-date.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/task-2/parse-date.js b/task-2/parse-date.js index 51c7256..951d6a1 100644 --- a/task-2/parse-date.js +++ b/task-2/parse-date.js @@ -7,6 +7,19 @@ function parseDateString(dateString) { let numbers = datePart.split("-"); + let first = Number(numbers[0]); + let second = Number(numbers[1]); + let third = Number(numbers[2]); + + let day; + let month; + let year = third; + + if(format ==="MDY"){ + month = first; + day = second; + } + ) } \ No newline at end of file From 81878052a4e127082a66b69addd788df3c62b74d Mon Sep 17 00:00:00 2001 From: hannahwn Date: Wed, 28 Jan 2026 14:23:58 +0100 Subject: [PATCH 07/13] tells format correctly --- task-2/parse-date.js | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/task-2/parse-date.js b/task-2/parse-date.js index 951d6a1..047e553 100644 --- a/task-2/parse-date.js +++ b/task-2/parse-date.js @@ -1,12 +1,14 @@ function parseDateString(dateString) { - let parts = dateString.split(""); + let parts = dateString.split(" "); - let format =parts[0]; + let format = parts[0]; let datePart = parts[1]; let numbers = datePart.split("-"); + + let first = Number(numbers[0]); let second = Number(numbers[1]); let third = Number(numbers[2]); @@ -15,11 +17,22 @@ function parseDateString(dateString) { let month; let year = third; - if(format ==="MDY"){ + if(format === "MDY"){ month = first; day = second; } + if (format === "DMY"){ + day = first; + month = second; + } + + let result = { + day: day,month: month, year: year + }; + + + return result; +} - ) -} \ No newline at end of file +console.log(parseDateString("MDY 10-21-1983")); \ No newline at end of file From ef3bd3b61c14d566a020cf3f5cb8312540ab2505 Mon Sep 17 00:00:00 2001 From: hannahwn Date: Wed, 28 Jan 2026 14:51:40 +0100 Subject: [PATCH 08/13] added formulas --- task-3/date.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 task-3/date.js diff --git a/task-3/date.js b/task-3/date.js new file mode 100644 index 0000000..03e736d --- /dev/null +++ b/task-3/date.js @@ -0,0 +1,18 @@ +export function convertHoursToMinutes(hours) { + return hours * 60 +} +export function convertMinutesToHours(minutes) { + return minutes / 60 +} +export function convertDaysToHours(days){ + return days * 24 +} +export function convertHoursToDays(hours){ + return hours / 24 +} +export function convertMinutesToSeconds(minutes){ + return minutes * 60 +} +export function convertSecondsToMinutes(seconds){ + return seconds / 60 +} \ No newline at end of file From 81c6c085cc055db5fa3ef1fa3f1ec6682e4bb627 Mon Sep 17 00:00:00 2001 From: hannahwn Date: Wed, 28 Jan 2026 15:52:45 +0100 Subject: [PATCH 09/13] changes degrees and describes it --- task-4/cleanup.js | 95 ++++++++++------------------------------------- 1 file changed, 19 insertions(+), 76 deletions(-) diff --git a/task-4/cleanup.js b/task-4/cleanup.js index 207523a..8d60c98 100644 --- a/task-4/cleanup.js +++ b/task-4/cleanup.js @@ -1,80 +1,23 @@ -// Temperature conversion and weather report for City 1 -let cityName1 = "Amsterdam"; -let tempCelsius1 = 22; -let tempFahrenheit1 = (tempCelsius1 * 9 / 5) + 32; -let tempKelvin1 = tempCelsius1 + 273.15; -console.log("Weather Report for " + cityName1); -console.log("Temperature: " + tempCelsius1 + "°C"); -console.log("Temperature: " + tempFahrenheit1 + "°F"); -console.log("Temperature: " + tempKelvin1 + "K"); -if (tempCelsius1 < 0) { - console.log("Status: Freezing"); -} else if (tempCelsius1 >= 0 && tempCelsius1 < 10) { - console.log("Status: Cold"); -} else if (tempCelsius1 >= 10 && tempCelsius1 < 20) { - console.log("Status: Mild"); -} else if (tempCelsius1 >= 20 && tempCelsius1 < 30) { - console.log("Status: Warm"); -} else { - console.log("Status: Hot"); +function CelsiusToFahrenheit(c){ + return(c*9/5) + 32; } -console.log("---"); -// Temperature conversion and weather report for City 2 -let cityName2 = "Berlin"; -let tempCelsius2 = 15; -let tempFahrenheit2 = (tempCelsius2 * 9 / 5) + 32; -let tempKelvin2 = tempCelsius2 + 273.15; -console.log("Weather Report for " + cityName2); -console.log("Temperature: " + tempCelsius2 + "°C"); -console.log("Temperature: " + tempFahrenheit2 + "°F"); -console.log("Temperature: " + tempKelvin2 + "K"); -if (tempCelsius2 < 0) { - console.log("Status: Freezing"); -} else if (tempCelsius2 >= 0 && tempCelsius2 < 10) { - console.log("Status: Cold"); -} else if (tempCelsius2 >= 10 && tempCelsius2 < 20) { - console.log("Status: Mild"); -} else if (tempCelsius2 >= 20 && tempCelsius2 < 30) { - console.log("Status: Warm"); -} else { - console.log("Status: Hot"); +function CelciusToKelvin(c){ + return c + 273.15; } -console.log("---"); -// Temperature conversion and weather report for City 3 -let cityName3 = "Copenhagen"; -let tempCelsius3 = -5; -let tempFahrenheit3 = (tempCelsius3 * 9 / 5) + 32; -let tempKelvin3 = tempCelsius3 + 273.15; -console.log("Weather Report for " + cityName3); -console.log("Temperature: " + tempCelsius3 + "°C"); -console.log("Temperature: " + tempFahrenheit3 + "°F"); -console.log("Temperature: " + tempKelvin3 + "K"); -if (tempCelsius3 < 0) { - console.log("Status: Freezing"); -} else if (tempCelsius3 >= 0 && tempCelsius3 < 10) { - console.log("Status: Cold"); -} else if (tempCelsius3 >= 10 && tempCelsius3 < 20) { - console.log("Status: Mild"); -} else if (tempCelsius3 >= 20 && tempCelsius3 < 30) { - console.log("Status: Warm"); -} else { - console.log("Status: Hot"); -} -console.log("---"); - -// Wind chill calculation for City 1 -let windSpeed1 = 15; -let windChill1 = 13.12 + 0.6215 * tempCelsius1 - 11.37 * Math.pow(windSpeed1, 0.16) + 0.3965 * tempCelsius1 * Math.pow(windSpeed1, 0.16); -console.log("Wind chill in " + cityName1 + ": " + windChill1.toFixed(2) + "°C"); - -// Wind chill calculation for City 2 -let windSpeed2 = 20; -let windChill2 = 13.12 + 0.6215 * tempCelsius2 - 11.37 * Math.pow(windSpeed2, 0.16) + 0.3965 * tempCelsius2 * Math.pow(windSpeed2, 0.16); -console.log("Wind chill in " + cityName2 + ": " + windChill2.toFixed(2) + "°C"); - -// Wind chill calculation for City 3 -let windSpeed3 = 25; -let windChill3 = 13.12 + 0.6215 * tempCelsius3 - 11.37 * Math.pow(windSpeed3, 0.16) + 0.3965 * tempCelsius3 * Math.pow(windSpeed3, 0.16); -console.log("Wind chill in " + cityName3 + ": " + windChill3.toFixed(2) + "°C"); \ No newline at end of file +function adddescription(c){ + if (c<0){ + return "Freezing"; + } + if(c<10){ + return "cold"; + } + if(c<20){ + return "Mild"; + } + if(c<30){ + return "Warm"; + } + return "Hot"; +} \ No newline at end of file From f9833606fa11fc41027dde07956f2a9c1ad36030 Mon Sep 17 00:00:00 2001 From: hannahwn Date: Wed, 28 Jan 2026 15:58:39 +0100 Subject: [PATCH 10/13] calculates wind --- task-4/cleanup.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/task-4/cleanup.js b/task-4/cleanup.js index 8d60c98..d8243b8 100644 --- a/task-4/cleanup.js +++ b/task-4/cleanup.js @@ -20,4 +20,15 @@ function adddescription(c){ return "Warm"; } return "Hot"; -} \ No newline at end of file +} + +function getWindChill(celsius, windKmPerHour) { + let windPower = Math.pow(windKmPerHour, 0.16); + + let answer = 13.12 + + 0.6215 * celsius - + 11.37 * windPower + + 0.3965 * celsius * windPower; + + return answer; +} From 69e1bcbfa3f0718978f853b4953ecdaa3f36c9d7 Mon Sep 17 00:00:00 2001 From: hannahwn Date: Wed, 28 Jan 2026 16:06:54 +0100 Subject: [PATCH 11/13] added things to print out --- task-4/cleanup.js | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/task-4/cleanup.js b/task-4/cleanup.js index d8243b8..63139b2 100644 --- a/task-4/cleanup.js +++ b/task-4/cleanup.js @@ -6,7 +6,7 @@ function CelciusToKelvin(c){ return c + 273.15; } -function adddescription(c){ +function AddDescription(c){ if (c<0){ return "Freezing"; } @@ -32,3 +32,42 @@ function getWindChill(celsius, windKmPerHour) { return answer; } +function showWeather(cityName, celsius, windSpeed) { + + let fahrenheit = CelsiusToFahrenheit(celsius); + let kelvin = CelciusToKelvin(celsius); + + + let feeling = AddDescription(celsius); + + + console.log("Weather Report for " + cityName); + console.log("Temperature: " + celsius + "°C"); + console.log("Temperature: " + fahrenheit + "°F"); + console.log("Temperature: " + kelvin + "K"); + console.log("Status: " + feeling); + console.log("---"); + + + if (windSpeed > 0) { + let chill = getWindChill(celsius, windSpeed); + console.log("Wind chill in " + cityName + ": " + chill.toFixed(1) + "°C"); + } +} + +let name1 = "Amsterdam"; +let temp1 = 22; +let wind1 = 15; +showWeather(name1, temp1, wind1); + + +let name2 = "Berlin"; +let temp2 = 15; +let wind2 = 20; +showWeather(name2, temp2, wind2); + + +let name3 = "Copenhagen"; +let temp3 = -5; +let wind3 = 25; +showWeather(name3, temp3, wind3); \ No newline at end of file From 24b25d93338aaac8e9c6e01157807e3feb87b9d6 Mon Sep 17 00:00:00 2001 From: hannahwn Date: Wed, 28 Jan 2026 16:09:32 +0100 Subject: [PATCH 12/13] added 2 cities --- task-4/cleanup.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/task-4/cleanup.js b/task-4/cleanup.js index 63139b2..e59f50c 100644 --- a/task-4/cleanup.js +++ b/task-4/cleanup.js @@ -70,4 +70,14 @@ showWeather(name2, temp2, wind2); let name3 = "Copenhagen"; let temp3 = -5; let wind3 = 25; -showWeather(name3, temp3, wind3); \ No newline at end of file +showWeather(name3, temp3, wind3); + +let name4 = "Nairobi"; +let temp4 = 20; +let wind4 = 12; +showWeather(name4, temp4, wind4); + +let name5 = "Paris"; +let temp5 = -2; +let wind5 = 30; +showWeather(name5, temp5, wind5); \ No newline at end of file From 427488df65420aacf919bd3fed28b25bee3649e8 Mon Sep 17 00:00:00 2001 From: hannahwn Date: Wed, 28 Jan 2026 16:16:25 +0100 Subject: [PATCH 13/13] allowed decimals --- task-4/cleanup.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/task-4/cleanup.js b/task-4/cleanup.js index e59f50c..eb4afd7 100644 --- a/task-4/cleanup.js +++ b/task-4/cleanup.js @@ -51,7 +51,7 @@ function showWeather(cityName, celsius, windSpeed) { if (windSpeed > 0) { let chill = getWindChill(celsius, windSpeed); - console.log("Wind chill in " + cityName + ": " + chill.toFixed(1) + "°C"); + console.log("Wind chill in " + cityName + ": " + chill + "°C"); } }