From dc7193f9c814e543f41dfa2c4541161d88cd74ab Mon Sep 17 00:00:00 2001 From: Arbeits-Sachen <105115862+Arbeits-Sachen@users.noreply.github.com> Date: Mon, 1 Aug 2022 11:44:12 +0100 Subject: [PATCH 01/45] Update exercise.js --- exercises/C-variables/exercise.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/exercises/C-variables/exercise.js b/exercises/C-variables/exercise.js index a6bbb9786..5bf262d0a 100644 --- a/exercises/C-variables/exercise.js +++ b/exercises/C-variables/exercise.js @@ -1,3 +1,5 @@ -// Start by creating a variable `greeting` +let greeting = "Hello world"; console.log(greeting); +console.log(greeting); +console.log(greeting); From a2eae5b946387f4de18bf6375607230e6ff9bd40 Mon Sep 17 00:00:00 2001 From: Arbeits-Sachen <105115862+Arbeits-Sachen@users.noreply.github.com> Date: Mon, 1 Aug 2022 11:45:58 +0100 Subject: [PATCH 02/45] Update exercise.js --- exercises/D-strings/exercise.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/exercises/D-strings/exercise.js b/exercises/D-strings/exercise.js index 2cffa6a81..904561720 100644 --- a/exercises/D-strings/exercise.js +++ b/exercises/D-strings/exercise.js @@ -1,3 +1,5 @@ -// Start by creating a variable `message` +let message = "This is a string"; +let messageType = typeof message; console.log(message); +console.log(messageType); From a495323f7a8a83b301930c8af20418c26c7adc31 Mon Sep 17 00:00:00 2001 From: Arbeits-Sachen <105115862+Arbeits-Sachen@users.noreply.github.com> Date: Mon, 1 Aug 2022 11:47:07 +0100 Subject: [PATCH 03/45] Update exercise.js --- exercises/E-strings-concatenation/exercise.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/exercises/E-strings-concatenation/exercise.js b/exercises/E-strings-concatenation/exercise.js index 2cffa6a81..25743a0e0 100644 --- a/exercises/E-strings-concatenation/exercise.js +++ b/exercises/E-strings-concatenation/exercise.js @@ -1,3 +1,5 @@ -// Start by creating a variable `message` +let greetingStart = "Hello, my name is "; +let name = "Daniel"; +let greeting = greetingStart + name; -console.log(message); +console.log(greeting); From 81106b203338dcd550cf1c8ece9a4a510cf64b28 Mon Sep 17 00:00:00 2001 From: Arbeits-Sachen <105115862+Arbeits-Sachen@users.noreply.github.com> Date: Mon, 1 Aug 2022 11:51:56 +0100 Subject: [PATCH 04/45] Update exercise.js --- exercises/F-strings-methods/exercise.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/exercises/F-strings-methods/exercise.js b/exercises/F-strings-methods/exercise.js index 2cffa6a81..a8cf30531 100644 --- a/exercises/F-strings-methods/exercise.js +++ b/exercises/F-strings-methods/exercise.js @@ -1,3 +1,8 @@ -// Start by creating a variable `message` +let name = "Daniel"; +let nameLength = name.length; +let nameText1 = "My name is Daniel and my name is " +let nameText2 = " characters long" -console.log(message); +let nameText = nameText1 + nameLength + nameText2; + +console.log(nameText); From dada91573bb2dd49a2a3eefb5d0543d301914704 Mon Sep 17 00:00:00 2001 From: Arbeits-Sachen <105115862+Arbeits-Sachen@users.noreply.github.com> Date: Mon, 1 Aug 2022 11:56:28 +0100 Subject: [PATCH 05/45] Update exercise.js --- exercises/F-strings-methods/exercise.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/exercises/F-strings-methods/exercise.js b/exercises/F-strings-methods/exercise.js index a8cf30531..6ce0e4219 100644 --- a/exercises/F-strings-methods/exercise.js +++ b/exercises/F-strings-methods/exercise.js @@ -1,8 +1,8 @@ let name = "Daniel"; let nameLength = name.length; -let nameText1 = "My name is Daniel and my name is " -let nameText2 = " characters long" +let message1 = "My name is Daniel and my name is " +let message2 = " characters long" -let nameText = nameText1 + nameLength + nameText2; +let message = message1 + nameLength + message2; -console.log(nameText); +console.log(message); From f0338ac3dea426e60969b2ce4a90444408f1d1a0 Mon Sep 17 00:00:00 2001 From: Arbeits-Sachen <105115862+Arbeits-Sachen@users.noreply.github.com> Date: Mon, 1 Aug 2022 12:00:32 +0100 Subject: [PATCH 06/45] Update exercise.js --- exercises/F-strings-methods/exercise.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/exercises/F-strings-methods/exercise.js b/exercises/F-strings-methods/exercise.js index 6ce0e4219..431f6d0d6 100644 --- a/exercises/F-strings-methods/exercise.js +++ b/exercises/F-strings-methods/exercise.js @@ -1,8 +1,5 @@ let name = "Daniel"; let nameLength = name.length; -let message1 = "My name is Daniel and my name is " -let message2 = " characters long" - -let message = message1 + nameLength + message2; +let message = "My name is " + name + " and my name is " + nameLength + " characters long" console.log(message); From 6e45950748438a36703350870a5455d2a681c85e Mon Sep 17 00:00:00 2001 From: Arbeits-Sachen <105115862+Arbeits-Sachen@users.noreply.github.com> Date: Mon, 1 Aug 2022 12:01:51 +0100 Subject: [PATCH 07/45] Update exercise.js --- exercises/F-strings-methods/exercise.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/F-strings-methods/exercise.js b/exercises/F-strings-methods/exercise.js index 431f6d0d6..054916132 100644 --- a/exercises/F-strings-methods/exercise.js +++ b/exercises/F-strings-methods/exercise.js @@ -1,5 +1,5 @@ let name = "Daniel"; let nameLength = name.length; -let message = "My name is " + name + " and my name is " + nameLength + " characters long" +let message = "My name is " + name + " and my name is " + nameLength + " characters long"; console.log(message); From 8a6b13b11434e0d1b21362bb5f4f373c853e20eb Mon Sep 17 00:00:00 2001 From: Arbeits-Sachen <105115862+Arbeits-Sachen@users.noreply.github.com> Date: Mon, 1 Aug 2022 12:05:41 +0100 Subject: [PATCH 08/45] Update exercise2.js --- exercises/F-strings-methods/exercise2.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/exercises/F-strings-methods/exercise2.js b/exercises/F-strings-methods/exercise2.js index b4b46943d..fc26eaa62 100644 --- a/exercises/F-strings-methods/exercise2.js +++ b/exercises/F-strings-methods/exercise2.js @@ -1,3 +1,5 @@ -const name = " Daniel "; +const name = "Daniel ".trim(); +let nameLength = name.length; +let message = "My name is " + name + " and my name is " + nameLength + " characters long"; console.log(message); From 913a95e30e1abb821866a0202f8112e62df3adc4 Mon Sep 17 00:00:00 2001 From: Arbeits-Sachen <105115862+Arbeits-Sachen@users.noreply.github.com> Date: Mon, 1 Aug 2022 12:12:40 +0100 Subject: [PATCH 09/45] Update exercise.js --- exercises/G-numbers/exercise.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/exercises/G-numbers/exercise.js b/exercises/G-numbers/exercise.js index 49e7bc00b..69136ebf5 100644 --- a/exercises/G-numbers/exercise.js +++ b/exercises/G-numbers/exercise.js @@ -1 +1,8 @@ -// Start by creating a variables `numberOfStudents` and `numberOfMentors` +let numberOfStudents = 15; +let numberOfMentors = 8; + +let total = numberOfStudents + numberOfMentors; + +console.log("Number of students: " + numberOfStudents) +console.log("Number of mentors: " + numberOfMentors) +console.log("Total numnber of students and mentors: " + total); From afb10dd200ba395232fbb935159148ed3b3033b1 Mon Sep 17 00:00:00 2001 From: Arbeits-Sachen <105115862+Arbeits-Sachen@users.noreply.github.com> Date: Mon, 1 Aug 2022 12:17:43 +0100 Subject: [PATCH 10/45] Update exercise.js --- exercises/I-floats/exercise.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/exercises/I-floats/exercise.js b/exercises/I-floats/exercise.js index a5bbcd852..b9b975c0e 100644 --- a/exercises/I-floats/exercise.js +++ b/exercises/I-floats/exercise.js @@ -1,2 +1,12 @@ -var numberOfStudents = 15; -var numberOfMentors = 8; +let numberOfStudents = 15; +let numberOfMentors = 8; + +let total = numberOfStudents + numberOfMentors; + +percent = 100 / total; + +let numberOfStudentsPercent = Math.round(percent * numberOfStudents); +let numberOfMentorsPercent = Math.round(percent * numberOfMentors); + +console.log("Number of students: " + numberOfStudentsPercent + "%") +console.log("Number of mentors: " + numberOfMentorsPercent + "%") From 72e7c0057de4a5153d37db95e49beb5c84a5da9a Mon Sep 17 00:00:00 2001 From: Arbeits-Sachen <105115862+Arbeits-Sachen@users.noreply.github.com> Date: Mon, 1 Aug 2022 12:18:22 +0100 Subject: [PATCH 11/45] Update exercise.js --- exercises/I-floats/exercise.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/I-floats/exercise.js b/exercises/I-floats/exercise.js index b9b975c0e..d1f7897b6 100644 --- a/exercises/I-floats/exercise.js +++ b/exercises/I-floats/exercise.js @@ -3,7 +3,7 @@ let numberOfMentors = 8; let total = numberOfStudents + numberOfMentors; -percent = 100 / total; +let percent = 100 / total; let numberOfStudentsPercent = Math.round(percent * numberOfStudents); let numberOfMentorsPercent = Math.round(percent * numberOfMentors); From eaf2053edd8e482aa3a81d1e974e7f8dbec8ee7b Mon Sep 17 00:00:00 2001 From: Arbeits-Sachen <105115862+Arbeits-Sachen@users.noreply.github.com> Date: Mon, 1 Aug 2022 12:38:54 +0100 Subject: [PATCH 12/45] Update exercise.js --- exercises/J-functions/exercise.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/exercises/J-functions/exercise.js b/exercises/J-functions/exercise.js index 0ae5850e5..648befa3e 100644 --- a/exercises/J-functions/exercise.js +++ b/exercises/J-functions/exercise.js @@ -1,5 +1,6 @@ -function halve(number) { - // complete the function here +function halve(number) +{ + return number / 2; } var result = halve(12); From cb0dbc38962f8b0463d8ce75b9f2e745631d2c2b Mon Sep 17 00:00:00 2001 From: Arbeits-Sachen <105115862+Arbeits-Sachen@users.noreply.github.com> Date: Mon, 1 Aug 2022 12:39:47 +0100 Subject: [PATCH 13/45] Update exercise2.js --- exercises/J-functions/exercise2.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/exercises/J-functions/exercise2.js b/exercises/J-functions/exercise2.js index 82ef5e780..1cba5ed23 100644 --- a/exercises/J-functions/exercise2.js +++ b/exercises/J-functions/exercise2.js @@ -1,5 +1,6 @@ -function triple(number) { - // complete function here +function triple(number) +{ + return number * 3; } var result = triple(12); From 0c0e2ec26ecf5cf1d92c71124e52cd6774a65014 Mon Sep 17 00:00:00 2001 From: Arbeits-Sachen <105115862+Arbeits-Sachen@users.noreply.github.com> Date: Mon, 1 Aug 2022 12:42:31 +0100 Subject: [PATCH 14/45] Update exercise.js --- exercises/K-functions-parameters/exercise.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/exercises/K-functions-parameters/exercise.js b/exercises/K-functions-parameters/exercise.js index 8d5db5e69..bdc3caa1c 100644 --- a/exercises/K-functions-parameters/exercise.js +++ b/exercises/K-functions-parameters/exercise.js @@ -1,9 +1,8 @@ -// Complete the function so that it takes input parameters -function multiply() { - // Calculate the result of the function and return it +function multiply(number1, number2) +{ + return number1 * number2; } -// Assign the result of calling the function the variable `result` var result = multiply(3, 4); console.log(result); From 7237b2a69065c3157811e1043daf9427940f65c3 Mon Sep 17 00:00:00 2001 From: Arbeits-Sachen <105115862+Arbeits-Sachen@users.noreply.github.com> Date: Mon, 1 Aug 2022 12:43:08 +0100 Subject: [PATCH 15/45] Update exercise2.js --- exercises/K-functions-parameters/exercise2.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/exercises/K-functions-parameters/exercise2.js b/exercises/K-functions-parameters/exercise2.js index db7a8904b..211539f4e 100644 --- a/exercises/K-functions-parameters/exercise2.js +++ b/exercises/K-functions-parameters/exercise2.js @@ -1,4 +1,7 @@ -// Declare your function first +function divide(number1, number2) +{ + return number1 / number2; +} var result = divide(3, 4); From 9048add70c2775efe57b806328e3cc8dea1b8b7b Mon Sep 17 00:00:00 2001 From: Arbeits-Sachen <105115862+Arbeits-Sachen@users.noreply.github.com> Date: Mon, 1 Aug 2022 12:45:04 +0100 Subject: [PATCH 16/45] Update exercise3.js --- exercises/K-functions-parameters/exercise3.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/exercises/K-functions-parameters/exercise3.js b/exercises/K-functions-parameters/exercise3.js index 537e9f4ec..feaca034c 100644 --- a/exercises/K-functions-parameters/exercise3.js +++ b/exercises/K-functions-parameters/exercise3.js @@ -1,5 +1,7 @@ -// Write your function here - +function createGreeting(name) +{ + return "Hello, my name is " + name; +} var greeting = createGreeting("Daniel"); console.log(greeting); From 72187899fd923a5c1bf9a9dec269b333e152a2b0 Mon Sep 17 00:00:00 2001 From: Arbeits-Sachen <105115862+Arbeits-Sachen@users.noreply.github.com> Date: Mon, 1 Aug 2022 12:46:36 +0100 Subject: [PATCH 17/45] Update exercise4.js --- exercises/K-functions-parameters/exercise4.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/exercises/K-functions-parameters/exercise4.js b/exercises/K-functions-parameters/exercise4.js index 7ab44589e..6ad905e33 100644 --- a/exercises/K-functions-parameters/exercise4.js +++ b/exercises/K-functions-parameters/exercise4.js @@ -1,5 +1,7 @@ -// Declare your function first - -// Call the function and assign to a variable `sum` +function add(num1, num2) +{ + return num1 + num2; +} +var sum = add(13, 124); console.log(sum); From f8ed4c4a7c0702f70457802188d240e9c6845b43 Mon Sep 17 00:00:00 2001 From: Arbeits-Sachen <105115862+Arbeits-Sachen@users.noreply.github.com> Date: Mon, 1 Aug 2022 12:48:26 +0100 Subject: [PATCH 18/45] Update exercise5.js --- exercises/K-functions-parameters/exercise5.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/exercises/K-functions-parameters/exercise5.js b/exercises/K-functions-parameters/exercise5.js index 7c5bcd605..caae16df3 100644 --- a/exercises/K-functions-parameters/exercise5.js +++ b/exercises/K-functions-parameters/exercise5.js @@ -1,4 +1,7 @@ -// Declare your function here +function createLongGreeting(name, num) +{ + return "Hello, my name is " + name + " and I'm " + num + " years old"; +} const greeting = createLongGreeting("Daniel", 30); From 0178210d54ec7ce6b7bf41e96e1af62afa5139af Mon Sep 17 00:00:00 2001 From: Arbeits-Sachen <105115862+Arbeits-Sachen@users.noreply.github.com> Date: Mon, 1 Aug 2022 12:59:45 +0100 Subject: [PATCH 19/45] Update exercise.js --- exercises/L-functions-nested/exercise.js | 37 ++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/exercises/L-functions-nested/exercise.js b/exercises/L-functions-nested/exercise.js index a5d377442..cebe2de3c 100644 --- a/exercises/L-functions-nested/exercise.js +++ b/exercises/L-functions-nested/exercise.js @@ -3,3 +3,40 @@ var mentor2 = "Irina"; var mentor3 = "Mimi"; var mentor4 = "Rob"; var mentor5 = "Yohannes"; + +function createGreeting1(mentor1) +{ + return ("hello " + mentor1).toUpperCase(); +} + +function createGreeting2(mentor2) +{ + return ("hello " + mentor2).toUpperCase(); +} + +function createGreeting3(mentor3) +{ + return ("hello " + mentor3).toUpperCase(); +} + +function createGreeting4(mentor4) +{ + return ("hello " + mentor4).toUpperCase(); +} + +function createGreeting5(mentor5) +{ + return ("hello " + mentor5).toUpperCase(); +} + +const greeting1 = createGreeting1(mentor1); +const greeting2 = createGreeting2(mentor2); +const greeting3 = createGreeting3(mentor3); +const greeting4 = createGreeting4(mentor4); +const greeting5 = createGreeting5(mentor5); + +console.log(greeting1); +console.log(greeting2); +console.log(greeting3); +console.log(greeting4); +console.log(greeting5); From 38ad5afba46b998bc421e61b9c24b34aade15279 Mon Sep 17 00:00:00 2001 From: Arbeits-Sachen <105115862+Arbeits-Sachen@users.noreply.github.com> Date: Mon, 1 Aug 2022 13:05:30 +0100 Subject: [PATCH 20/45] Update exercise.js --- exercises/L-functions-nested/exercise.js | 34 +++++------------------- 1 file changed, 7 insertions(+), 27 deletions(-) diff --git a/exercises/L-functions-nested/exercise.js b/exercises/L-functions-nested/exercise.js index cebe2de3c..b2d5fccff 100644 --- a/exercises/L-functions-nested/exercise.js +++ b/exercises/L-functions-nested/exercise.js @@ -4,36 +4,16 @@ var mentor3 = "Mimi"; var mentor4 = "Rob"; var mentor5 = "Yohannes"; -function createGreeting1(mentor1) +function createGreeting(mentor) { - return ("hello " + mentor1).toUpperCase(); + return ("hello " + mentor).toUpperCase(); } -function createGreeting2(mentor2) -{ - return ("hello " + mentor2).toUpperCase(); -} - -function createGreeting3(mentor3) -{ - return ("hello " + mentor3).toUpperCase(); -} - -function createGreeting4(mentor4) -{ - return ("hello " + mentor4).toUpperCase(); -} - -function createGreeting5(mentor5) -{ - return ("hello " + mentor5).toUpperCase(); -} - -const greeting1 = createGreeting1(mentor1); -const greeting2 = createGreeting2(mentor2); -const greeting3 = createGreeting3(mentor3); -const greeting4 = createGreeting4(mentor4); -const greeting5 = createGreeting5(mentor5); +const greeting1 = createGreeting(mentor1); +const greeting2 = createGreeting(mentor2); +const greeting3 = createGreeting(mentor3); +const greeting4 = createGreeting(mentor4); +const greeting5 = createGreeting(mentor5); console.log(greeting1); console.log(greeting2); From 983d15045c5032f75a2e15fdc487b9012e9dc0c7 Mon Sep 17 00:00:00 2001 From: Arbeits-Sachen <105115862+Arbeits-Sachen@users.noreply.github.com> Date: Mon, 1 Aug 2022 13:20:25 +0100 Subject: [PATCH 21/45] Update exercise.js --- exercises/C-variables/exercise.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/C-variables/exercise.js b/exercises/C-variables/exercise.js index 5bf262d0a..a01120326 100644 --- a/exercises/C-variables/exercise.js +++ b/exercises/C-variables/exercise.js @@ -1,4 +1,4 @@ -let greeting = "Hello world"; +var greeting = "Hello world"; console.log(greeting); console.log(greeting); From df8e91fdf1d890f8765debd2ff2d060778d186be Mon Sep 17 00:00:00 2001 From: Arbeits-Sachen <105115862+Arbeits-Sachen@users.noreply.github.com> Date: Mon, 1 Aug 2022 13:20:41 +0100 Subject: [PATCH 22/45] Update exercise.js --- exercises/D-strings/exercise.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exercises/D-strings/exercise.js b/exercises/D-strings/exercise.js index 904561720..344e5c1db 100644 --- a/exercises/D-strings/exercise.js +++ b/exercises/D-strings/exercise.js @@ -1,5 +1,5 @@ -let message = "This is a string"; -let messageType = typeof message; +var message = "This is a string"; +var messageType = typeof message; console.log(message); console.log(messageType); From 2b78de9ed31710378d58cd6e70ede22ac8aeaf9d Mon Sep 17 00:00:00 2001 From: Arbeits-Sachen <105115862+Arbeits-Sachen@users.noreply.github.com> Date: Mon, 1 Aug 2022 13:20:55 +0100 Subject: [PATCH 23/45] Update exercise.js --- exercises/E-strings-concatenation/exercise.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exercises/E-strings-concatenation/exercise.js b/exercises/E-strings-concatenation/exercise.js index 25743a0e0..81dbad022 100644 --- a/exercises/E-strings-concatenation/exercise.js +++ b/exercises/E-strings-concatenation/exercise.js @@ -1,5 +1,5 @@ -let greetingStart = "Hello, my name is "; -let name = "Daniel"; -let greeting = greetingStart + name; +var greetingStart = "Hello, my name is "; +var name = "Daniel"; +var greeting = greetingStart + name; console.log(greeting); From d51c3588767a9dbabe6354daf187010afe191901 Mon Sep 17 00:00:00 2001 From: Arbeits-Sachen <105115862+Arbeits-Sachen@users.noreply.github.com> Date: Mon, 1 Aug 2022 13:21:16 +0100 Subject: [PATCH 24/45] Update exercise.js --- exercises/F-strings-methods/exercise.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exercises/F-strings-methods/exercise.js b/exercises/F-strings-methods/exercise.js index 054916132..230a51316 100644 --- a/exercises/F-strings-methods/exercise.js +++ b/exercises/F-strings-methods/exercise.js @@ -1,5 +1,5 @@ -let name = "Daniel"; -let nameLength = name.length; -let message = "My name is " + name + " and my name is " + nameLength + " characters long"; +var name = "Daniel"; +var nameLength = name.length; +var message = "My name is " + name + " and my name is " + nameLength + " characters long"; console.log(message); From 7868546a6f685f28e36dbbbdd84908f25cc31f44 Mon Sep 17 00:00:00 2001 From: Arbeits-Sachen <105115862+Arbeits-Sachen@users.noreply.github.com> Date: Mon, 1 Aug 2022 13:21:35 +0100 Subject: [PATCH 25/45] Update exercise2.js --- exercises/F-strings-methods/exercise2.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exercises/F-strings-methods/exercise2.js b/exercises/F-strings-methods/exercise2.js index fc26eaa62..3d5d36726 100644 --- a/exercises/F-strings-methods/exercise2.js +++ b/exercises/F-strings-methods/exercise2.js @@ -1,5 +1,5 @@ const name = "Daniel ".trim(); -let nameLength = name.length; -let message = "My name is " + name + " and my name is " + nameLength + " characters long"; +var nameLength = name.length; +var message = "My name is " + name + " and my name is " + nameLength + " characters long"; console.log(message); From 1b0e2a29d14913764fb5ed93f0897d26ae4a290a Mon Sep 17 00:00:00 2001 From: Arbeits-Sachen <105115862+Arbeits-Sachen@users.noreply.github.com> Date: Mon, 1 Aug 2022 13:21:52 +0100 Subject: [PATCH 26/45] Update exercise.js --- exercises/G-numbers/exercise.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exercises/G-numbers/exercise.js b/exercises/G-numbers/exercise.js index 69136ebf5..b5c302e5f 100644 --- a/exercises/G-numbers/exercise.js +++ b/exercises/G-numbers/exercise.js @@ -1,7 +1,7 @@ -let numberOfStudents = 15; -let numberOfMentors = 8; +var numberOfStudents = 15; +var numberOfMentors = 8; -let total = numberOfStudents + numberOfMentors; +var total = numberOfStudents + numberOfMentors; console.log("Number of students: " + numberOfStudents) console.log("Number of mentors: " + numberOfMentors) From 8e9f2964f7a4a476a3b37a32a537fa257dc87625 Mon Sep 17 00:00:00 2001 From: Arbeits-Sachen <105115862+Arbeits-Sachen@users.noreply.github.com> Date: Mon, 1 Aug 2022 13:22:12 +0100 Subject: [PATCH 27/45] Update exercise.js --- exercises/I-floats/exercise.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/exercises/I-floats/exercise.js b/exercises/I-floats/exercise.js index d1f7897b6..078ed7540 100644 --- a/exercises/I-floats/exercise.js +++ b/exercises/I-floats/exercise.js @@ -1,12 +1,12 @@ -let numberOfStudents = 15; -let numberOfMentors = 8; +var numberOfStudents = 15; +var numberOfMentors = 8; -let total = numberOfStudents + numberOfMentors; +var total = numberOfStudents + numberOfMentors; -let percent = 100 / total; +var percent = 100 / total; -let numberOfStudentsPercent = Math.round(percent * numberOfStudents); -let numberOfMentorsPercent = Math.round(percent * numberOfMentors); +var numberOfStudentsPercent = Math.round(percent * numberOfStudents); +var numberOfMentorsPercent = Math.round(percent * numberOfMentors); console.log("Number of students: " + numberOfStudentsPercent + "%") console.log("Number of mentors: " + numberOfMentorsPercent + "%") From 2f0d2d55d06b442d2210b726657da475415b0b35 Mon Sep 17 00:00:00 2001 From: Arbeits-Sachen <105115862+Arbeits-Sachen@users.noreply.github.com> Date: Mon, 1 Aug 2022 17:14:22 +0100 Subject: [PATCH 28/45] Update 1-syntax-errors.js --- mandatory/1-syntax-errors.js | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/mandatory/1-syntax-errors.js b/mandatory/1-syntax-errors.js index a10cc9ac2..ea5c05859 100644 --- a/mandatory/1-syntax-errors.js +++ b/mandatory/1-syntax-errors.js @@ -1,16 +1,20 @@ // There are syntax errors in this code - can you fix it to pass the tests? -function addNumbers(a b c) { - return a + b + c; +function addNumbers(a, b, c) +{ + return a + b + c; } - + function introduceMe(name, age) - return "Hello, my name is " + name "and I am " age + "years old"; - -function getTotal(a, b) { - total = a ++ b; - - return "The total is total"; +{ + return "Hello, my name is " + name + "and I am " + age + "years old"; +} + +function getTotal(a, b) +{ + total = a + b; + + return "The total is " + total; } /* From 2cca2ed330b17f907ea7eeb95f9aeb6cc68a0fd4 Mon Sep 17 00:00:00 2001 From: Arbeits-Sachen <105115862+Arbeits-Sachen@users.noreply.github.com> Date: Mon, 1 Aug 2022 17:30:24 +0100 Subject: [PATCH 29/45] Update 2-logic-error.js --- mandatory/2-logic-error.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/mandatory/2-logic-error.js b/mandatory/2-logic-error.js index 9cca7603b..ef284556e 100644 --- a/mandatory/2-logic-error.js +++ b/mandatory/2-logic-error.js @@ -1,16 +1,18 @@ // The syntax for this function is valid but it has an error, find it and fix it. -function trimWord(word) { - return wordtrim(); +function trimWord(word) +{ + return word.trim(); } - -function getStringLength(word) { - return "word".length(); + +function getStringLength(word) +{ + return word.length; } - -function multiply(a, b, c) { - a * b * c; - return; + +function multiply(a, b, c) +{ + return a * b * c; } /* From fcdf0e0c514aa29a62159b36e6ae98e09b710337 Mon Sep 17 00:00:00 2001 From: Arbeits-Sachen <105115862+Arbeits-Sachen@users.noreply.github.com> Date: Mon, 1 Aug 2022 17:48:22 +0100 Subject: [PATCH 30/45] Update 3-function-output.js --- mandatory/3-function-output.js | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/mandatory/3-function-output.js b/mandatory/3-function-output.js index 5a953ba60..680fd29d8 100644 --- a/mandatory/3-function-output.js +++ b/mandatory/3-function-output.js @@ -1,16 +1,20 @@ // Add comments to explain what this function does. You're meant to use Google! -function getRandomNumber() { - return Math.random() * 10; +function getRandomNumber() +{ + //This function gets a random number between 0 and 1 and returns the result after multiplying the random number and the 10. + return Math.random() * 10; } - -// Add comments to explain what this function does. You're meant to use Google! -function combine2Words(word1, word2) { - return word1.concat(word2); + + // Add comments to explain what this function does. You're meant to use Google! +function combine2Words(word1, word2) +{ + //This function joins the two words together and then its returns the value. + return word1.concat(word2); } - -function concatenate(firstWord, secondWord, thirdWord) { - // Write the body of this function to concatenate three words together. - // Look at the test case below to understand what this function is expected to return. + +function concatenate(firstWord, secondWord, thirdWord) +{ + return firstWord.concat(" ", secondWord, " ", thirdWord); } /* From 73cd80b311ddd2c0db4097926d548990885d7ce5 Mon Sep 17 00:00:00 2001 From: Arbeits-Sachen <105115862+Arbeits-Sachen@users.noreply.github.com> Date: Mon, 1 Aug 2022 18:02:02 +0100 Subject: [PATCH 31/45] Update 4-tax.js --- mandatory/4-tax.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/mandatory/4-tax.js b/mandatory/4-tax.js index ba77c7ae2..66d439e67 100644 --- a/mandatory/4-tax.js +++ b/mandatory/4-tax.js @@ -5,7 +5,10 @@ Sales tax is 20% of the price of the product. */ -function calculateSalesTax() {} +function calculateSalesTax(num1) +{ + return num1 * 1.2; +} /* CURRENCY FORMATTING @@ -13,11 +16,13 @@ function calculateSalesTax() {} The business has informed you that prices must have 2 decimal places They must also start with the currency symbol Write a function that adds tax to a number, and then transforms the total into the format £0.00 - Remember that the prices must include the sales tax (hint: you already wrote a function for this!) */ -function addTaxAndFormatCurrency() {} +function addTaxAndFormatCurrency(num2) +{ + return "£" + calculateSalesTax(num2).toFixed(2); +} /* =================================================== From 21994c50e3c2b7ccff8da58d18cffa65eb4bab88 Mon Sep 17 00:00:00 2001 From: Arbeits-Sachen <105115862+Arbeits-Sachen@users.noreply.github.com> Date: Mon, 1 Aug 2022 18:28:47 +0100 Subject: [PATCH 32/45] Update 1-syntax-errors.js --- mandatory/1-syntax-errors.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mandatory/1-syntax-errors.js b/mandatory/1-syntax-errors.js index ea5c05859..dbda99125 100644 --- a/mandatory/1-syntax-errors.js +++ b/mandatory/1-syntax-errors.js @@ -7,7 +7,7 @@ function addNumbers(a, b, c) function introduceMe(name, age) { - return "Hello, my name is " + name + "and I am " + age + "years old"; + return "Hello, my name is " + name + " and I am " + age + " years old"; } function getTotal(a, b) From 2e87b2553b477b96c6a682768967fc087d665e9b Mon Sep 17 00:00:00 2001 From: Arbeits-Sachen <105115862+Arbeits-Sachen@users.noreply.github.com> Date: Mon, 1 Aug 2022 18:42:09 +0100 Subject: [PATCH 33/45] Update 1-currency-conversion.js --- extra/1-currency-conversion.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/extra/1-currency-conversion.js b/extra/1-currency-conversion.js index 75b3c6aab..bf41fcffc 100644 --- a/extra/1-currency-conversion.js +++ b/extra/1-currency-conversion.js @@ -5,7 +5,10 @@ Write a function that converts a price to USD (exchange rate is 1.4 $ to £) */ -function convertToUSD() {} +function convertToUSD(amount) +{ + return (amount * 1.4).toFixed(2); +} /* CURRENCY CONVERSION @@ -15,7 +18,10 @@ function convertToUSD() {} They have also decided that they should add a 1% fee to all foreign transactions, which means you only convert 99% of the £ to BRL. */ -function convertToBRL() {} +function convertToBRL(amount) +{ + return ((amount * 0.99) * 5.7).toFixed(2); +} /* ======= TESTS - DO NOT MODIFY ===== There are some Tests in this file that will help you work out if your code is working. From 6ef51daaf71f642ffa9046487bc4e6181b2f9a67 Mon Sep 17 00:00:00 2001 From: Arbeits-Sachen <105115862+Arbeits-Sachen@users.noreply.github.com> Date: Mon, 1 Aug 2022 18:44:40 +0100 Subject: [PATCH 34/45] Update 1-currency-conversion.js --- extra/1-currency-conversion.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra/1-currency-conversion.js b/extra/1-currency-conversion.js index bf41fcffc..d4c0d52ff 100644 --- a/extra/1-currency-conversion.js +++ b/extra/1-currency-conversion.js @@ -7,7 +7,7 @@ function convertToUSD(amount) { - return (amount * 1.4).toFixed(2); + return amount * 1.4; } /* From 07bf0c6f1e1a5c88caa59cb6fd9425b0e4b52ea0 Mon Sep 17 00:00:00 2001 From: Arbeits-Sachen <105115862+Arbeits-Sachen@users.noreply.github.com> Date: Mon, 1 Aug 2022 19:16:20 +0100 Subject: [PATCH 35/45] Update 2-piping.js --- extra/2-piping.js | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/extra/2-piping.js b/extra/2-piping.js index b4f8c4c1b..dd0fbd007 100644 --- a/extra/2-piping.js +++ b/extra/2-piping.js @@ -5,7 +5,6 @@ - one that adds 2 numbers together - one that multiplies 2 numbers together - one that formats a number so it's returned as a string with a £ sign before it (e.g. 20 -> £20) - 2. Using the variable startingValue as input, perform the following operations using your functions all on one line (assign the result to the variable badCode): - add 10 to startingValue @@ -16,26 +15,34 @@ the final result to the variable goodCode */ -function add() { - +function add(num1, num2) +{ + return num1 + num2; } -function multiply() { - +function multiply(num1, num2) +{ + return num1 * num2; } -function format() { - +function format(num1) +{ + return "£" + num1.toString(); } const startingValue = 2; // Why can this code be seen as bad practice? Comment your answer. -let badCode = +let badCode = 12; +//let badCode = 12 * 3; +badCode = badCode * 2;;//this should work, i dont know +console.log(badCode);//is might work -/* BETTER PRACTICE */ -let goodCode = +/* BETTER PRACTICE */ +let goodCode = 12; +goodCode *= 2; +console.log(goodCode); /* ======= TESTS - DO NOT MODIFY ===== There are some Tests in this file that will help you work out if your code is working. From 1a8f695799e45d319d935c9ede2083e52ca6f2f5 Mon Sep 17 00:00:00 2001 From: Arbeits-Sachen <105115862+Arbeits-Sachen@users.noreply.github.com> Date: Mon, 1 Aug 2022 19:20:16 +0100 Subject: [PATCH 36/45] Update 2-piping.js --- extra/2-piping.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extra/2-piping.js b/extra/2-piping.js index dd0fbd007..53f334f60 100644 --- a/extra/2-piping.js +++ b/extra/2-piping.js @@ -36,13 +36,13 @@ const startingValue = 2; let badCode = 12; //let badCode = 12 * 3; badCode = badCode * 2;;//this should work, i dont know -console.log(badCode);//is might work +console.log("£" + badCode);//is might work /* BETTER PRACTICE */ let goodCode = 12; goodCode *= 2; -console.log(goodCode); +console.log("£" + goodCode); /* ======= TESTS - DO NOT MODIFY ===== There are some Tests in this file that will help you work out if your code is working. From ba49a1fb96cc64bafe17fd1727310d938b2dfba9 Mon Sep 17 00:00:00 2001 From: Arbeits-Sachen <105115862+Arbeits-Sachen@users.noreply.github.com> Date: Mon, 1 Aug 2022 19:25:16 +0100 Subject: [PATCH 37/45] Update 2-piping.js --- extra/2-piping.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/extra/2-piping.js b/extra/2-piping.js index 53f334f60..d43904b43 100644 --- a/extra/2-piping.js +++ b/extra/2-piping.js @@ -33,16 +33,17 @@ function format(num1) const startingValue = 2; // Why can this code be seen as bad practice? Comment your answer. +//This code is bad because it leaves a mess behind without cleaning up the code. let badCode = 12; //let badCode = 12 * 3; -badCode = badCode * 2;;//this should work, i dont know -console.log("£" + badCode);//is might work +badCode = "£" +(badCode * 2);;//this should work, i dont know +console.log(badCode);//this might work /* BETTER PRACTICE */ let goodCode = 12; -goodCode *= 2; -console.log("£" + goodCode); +goodCode = "£" + (goodCode * 2); +console.log(goodCode); /* ======= TESTS - DO NOT MODIFY ===== There are some Tests in this file that will help you work out if your code is working. From 463a884d2ed4f47bdef46e3654ce3e304ec6825a Mon Sep 17 00:00:00 2001 From: Arbeits-Sachen <105115862+Arbeits-Sachen@users.noreply.github.com> Date: Mon, 1 Aug 2022 19:30:42 +0100 Subject: [PATCH 38/45] Update exercise.js --- exercises/B-hello-world/exercise.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/B-hello-world/exercise.js b/exercises/B-hello-world/exercise.js index b179ee953..a6b8c64d8 100644 --- a/exercises/B-hello-world/exercise.js +++ b/exercises/B-hello-world/exercise.js @@ -1 +1 @@ -console.log("Hello world"); +console.log("Hello World. I just started learning JavaScript!"); From 48563e3f9f54fecec69f39837e6a975429374621 Mon Sep 17 00:00:00 2001 From: Arbeits-Sachen <105115862+Arbeits-Sachen@users.noreply.github.com> Date: Mon, 1 Aug 2022 19:52:41 +0100 Subject: [PATCH 39/45] Update 2-piping.js --- extra/2-piping.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/extra/2-piping.js b/extra/2-piping.js index d43904b43..39b7f5f88 100644 --- a/extra/2-piping.js +++ b/extra/2-piping.js @@ -33,16 +33,19 @@ function format(num1) const startingValue = 2; // Why can this code be seen as bad practice? Comment your answer. -//This code is bad because it leaves a mess behind without cleaning up the code. -let badCode = 12; -//let badCode = 12 * 3; -badCode = "£" +(badCode * 2);;//this should work, i dont know +//This code is bad because it leaves a mess behind without cleaning up the code. It also does too many calcualations which cant ebe done in one claculation. +let badCode = 0; +//let badCode = 0 + startingValue; +badCode = startingValue + badCode;;//this should work, i dont know +badCode = badCode * startingValue;//does this equal 4? +badCode = startingValue * 12;//this should be enough +badCode = "£" + badCode; console.log(badCode);//this might work /* BETTER PRACTICE */ -let goodCode = 12; -goodCode = "£" + (goodCode * 2); +let goodCode = 0; +goodCode = "£" + ((goodCode + startingValue) * 12); console.log(goodCode); /* ======= TESTS - DO NOT MODIFY ===== From 8fc1b5d06e407af1da73b866bbf4a6e77b66db8f Mon Sep 17 00:00:00 2001 From: Arbeits-Sachen <105115862+Arbeits-Sachen@users.noreply.github.com> Date: Wed, 3 Aug 2022 14:11:31 +0100 Subject: [PATCH 40/45] Update 1-currency-conversion.js --- extra/1-currency-conversion.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra/1-currency-conversion.js b/extra/1-currency-conversion.js index d4c0d52ff..2b9dcc2ba 100644 --- a/extra/1-currency-conversion.js +++ b/extra/1-currency-conversion.js @@ -20,7 +20,7 @@ function convertToUSD(amount) function convertToBRL(amount) { - return ((amount * 0.99) * 5.7).toFixed(2); + return parseInt(((amount * 0.99) * 5.7).toFixed(2)); } /* ======= TESTS - DO NOT MODIFY ===== From 9ea1621eae2da3916ba61844477ebae3f838d882 Mon Sep 17 00:00:00 2001 From: Arbeits-Sachen <105115862+Arbeits-Sachen@users.noreply.github.com> Date: Wed, 3 Aug 2022 14:31:26 +0100 Subject: [PATCH 41/45] Update 1-currency-conversion.js --- extra/1-currency-conversion.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra/1-currency-conversion.js b/extra/1-currency-conversion.js index 2b9dcc2ba..c980bd353 100644 --- a/extra/1-currency-conversion.js +++ b/extra/1-currency-conversion.js @@ -20,7 +20,7 @@ function convertToUSD(amount) function convertToBRL(amount) { - return parseInt(((amount * 0.99) * 5.7).toFixed(2)); + return (amount * 0.99) * 5.7; } /* ======= TESTS - DO NOT MODIFY ===== From b6c273da78ba38f5995f632bc8cc604fe22da5d6 Mon Sep 17 00:00:00 2001 From: Arbeits-Sachen <105115862+Arbeits-Sachen@users.noreply.github.com> Date: Thu, 4 Aug 2022 12:51:18 +0100 Subject: [PATCH 42/45] Update 1-currency-conversion.js --- extra/1-currency-conversion.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra/1-currency-conversion.js b/extra/1-currency-conversion.js index c980bd353..8f51138c0 100644 --- a/extra/1-currency-conversion.js +++ b/extra/1-currency-conversion.js @@ -20,7 +20,7 @@ function convertToUSD(amount) function convertToBRL(amount) { - return (amount * 0.99) * 5.7; + return parseFloat(((amount * 0.99) * 5.7).toFixed(2)); } /* ======= TESTS - DO NOT MODIFY ===== From 053c9193dfbb27ba23d49515f0881192c42565d5 Mon Sep 17 00:00:00 2001 From: Arbeits-Sachen <105115862+Arbeits-Sachen@users.noreply.github.com> Date: Thu, 4 Aug 2022 13:58:10 +0100 Subject: [PATCH 43/45] Update 3-magic-8-ball.js --- extra/3-magic-8-ball.js | 50 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 46 insertions(+), 4 deletions(-) diff --git a/extra/3-magic-8-ball.js b/extra/3-magic-8-ball.js index 46f65f928..bcf8a7d7f 100644 --- a/extra/3-magic-8-ball.js +++ b/extra/3-magic-8-ball.js @@ -45,8 +45,31 @@ // This should log "The ball has shaken!" // and return the answer. -function shakeBall() { - //Write your code in here +function shakeBall() +{ + let answer = [ + "It is certain.", + "It is decidedly so.", + "Without a doubt.", + "Yes - definitely.", + "You may rely on it.", + "As I see it, yes.", + "Most likely.", + "Outlook good.", + "Yes.", + "Signs point to yes.", + "Reply hazy, try again.", + "Ask again later.", + "Better not tell you now.", + "Cannot predict now.", + "Concentrate and ask again.", + "Don't count on it.", + "My reply is no.", + "My sources say no.", + "Outlook not so good.", + "Very doubtful."]; + console.log("The ball has shaken!"); + return answer[Math.floor(Math.random() * answer.length)]; } /* @@ -58,8 +81,27 @@ function shakeBall() { This function should expect to be called with any value which was returned by the shakeBall function. */ -function checkAnswer(answer) { - //Write your code in here +function checkAnswer(answer) +{ + if (answer == ("It is certain.") || answer == ("It is decidedly so.") || answer == ("Without a doubt.") || answer == ("Yes - definitely.") || answer == ("You may rely on it.")) + { + return "very positive" + } + + else if (answer == ("As I see it, yes.") || answer == ("Most likely.") || answer == ("Outlook good.") || answer == ("Yes.") || answer == ("Signs point to yes.")) + { + return "positive" + } + + else if (answer == ("Reply hazy, try again.") || answer == ("Ask again later.") || answer == ("Better not tell you now.") || answer == ("Cannot predict now.") || answer == ("Concentrate and ask again.")) + { + return "negative" + } + + else if (answer == ("Don't count on it.") || answer == ("My reply is no.") || answer == ("My sources say no.") || answer == ("Outlook not so good.") || answer == ("Very doubtful.")) + { + return "very negative" + } } /* From 374c37312dc003157812b024c299ffe174e7d136 Mon Sep 17 00:00:00 2001 From: Arbeits-Sachen <105115862+Arbeits-Sachen@users.noreply.github.com> Date: Thu, 4 Aug 2022 13:58:54 +0100 Subject: [PATCH 44/45] Update 3-magic-8-ball.js --- extra/3-magic-8-ball.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra/3-magic-8-ball.js b/extra/3-magic-8-ball.js index bcf8a7d7f..4fb24e454 100644 --- a/extra/3-magic-8-ball.js +++ b/extra/3-magic-8-ball.js @@ -47,7 +47,7 @@ // and return the answer. function shakeBall() { - let answer = [ + const answer = [ "It is certain.", "It is decidedly so.", "Without a doubt.", From 46d6d3944ec316ddd3310c480f25d0a1d5847243 Mon Sep 17 00:00:00 2001 From: Arbeits-Sachen <105115862+Arbeits-Sachen@users.noreply.github.com> Date: Thu, 4 Aug 2022 15:04:19 +0100 Subject: [PATCH 45/45] Update 3-magic-8-ball.js --- extra/3-magic-8-ball.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/extra/3-magic-8-ball.js b/extra/3-magic-8-ball.js index 4fb24e454..62cc6a899 100644 --- a/extra/3-magic-8-ball.js +++ b/extra/3-magic-8-ball.js @@ -83,22 +83,22 @@ function shakeBall() */ function checkAnswer(answer) { - if (answer == ("It is certain.") || answer == ("It is decidedly so.") || answer == ("Without a doubt.") || answer == ("Yes - definitely.") || answer == ("You may rely on it.")) + if (answer === ("It is certain.") || answer === ("It is decidedly so.") || answer === ("Without a doubt.") || answer === ("Yes - definitely.") || answer === ("You may rely on it.")) { return "very positive" } - else if (answer == ("As I see it, yes.") || answer == ("Most likely.") || answer == ("Outlook good.") || answer == ("Yes.") || answer == ("Signs point to yes.")) + else if (answer === ("As I see it, yes.") || answer === ("Most likely.") || answer === ("Outlook good.") || answer === ("Yes.") || answer === ("Signs point to yes.")) { return "positive" } - else if (answer == ("Reply hazy, try again.") || answer == ("Ask again later.") || answer == ("Better not tell you now.") || answer == ("Cannot predict now.") || answer == ("Concentrate and ask again.")) + else if (answer === ("Reply hazy, try again.") || answer === ("Ask again later.") || answer === ("Better not tell you now.") || answer === ("Cannot predict now.") || answer === ("Concentrate and ask again.")) { return "negative" } - else if (answer == ("Don't count on it.") || answer == ("My reply is no.") || answer == ("My sources say no.") || answer == ("Outlook not so good.") || answer == ("Very doubtful.")) + else if (answer === ("Don't count on it.") || answer === ("My reply is no.") || answer === ("My sources say no.") || answer === ("Outlook not so good.") || answer === ("Very doubtful.")) { return "very negative" }