From 8d54256ff1ed21c9b0fc40db2237f7f8761137c8 Mon Sep 17 00:00:00 2001 From: GemPearl <65920912+GemPearl@users.noreply.github.com> Date: Mon, 9 Aug 2021 09:51:03 +0100 Subject: [PATCH 1/7] Exercise progress made Exercises A, B, C, D, E and F completed --- exercises/B-hello-world/exercise.js | 4 ++++ exercises/C-variables/exercise.js | 4 +++- exercises/D-strings/exercise.js | 6 ++++-- exercises/E-strings-concatenation/exercise.js | 5 ++++- exercises/F-strings-methods/exercise.js | 7 ++++++- exercises/F-strings-methods/exercise2.js | 11 +++++++++-- exercises/G-numbers/exercise.js | 3 +++ 7 files changed, 33 insertions(+), 7 deletions(-) diff --git a/exercises/B-hello-world/exercise.js b/exercises/B-hello-world/exercise.js index b179ee953..b2482056d 100644 --- a/exercises/B-hello-world/exercise.js +++ b/exercises/B-hello-world/exercise.js @@ -1 +1,5 @@ console.log("Hello world"); +console.log("Hello world, I am enjoying my coding journey"); +console.log() +console.log() +console.log() diff --git a/exercises/C-variables/exercise.js b/exercises/C-variables/exercise.js index a6bbb9786..33d103c03 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 ="Welcome to rewarding journey of JS" +console.log(greeting); +console.log(greeting); console.log(greeting); diff --git a/exercises/D-strings/exercise.js b/exercises/D-strings/exercise.js index 2cffa6a81..7250960c2 100644 --- a/exercises/D-strings/exercise.js +++ b/exercises/D-strings/exercise.js @@ -1,3 +1,5 @@ // Start by creating a variable `message` - -console.log(message); +let message= "This is a string"; +let messageType = typeof message; //find the data type +console.log(message); //Log 'This is a string' +console.log(messageType);//Log 'string' diff --git a/exercises/E-strings-concatenation/exercise.js b/exercises/E-strings-concatenation/exercise.js index 2cffa6a81..a5ac4ff69 100644 --- a/exercises/E-strings-concatenation/exercise.js +++ b/exercises/E-strings-concatenation/exercise.js @@ -1,3 +1,6 @@ // Start by creating a variable `message` +let greetingstart ="Hello my name is "; +let myName = "Nonye"; -console.log(message); +let greeting = greetingstart + myName; +console.log(greeting); //logs Hello my name is Nonye diff --git a/exercises/F-strings-methods/exercise.js b/exercises/F-strings-methods/exercise.js index 2cffa6a81..399bda33e 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 greetingstart ="Hello my name is "; +let myName = "Nonye"; +let nameLength = myName.length;// the length of the character of myName + +let greeting = `${greetingstart} ${myName} and my name is ${nameLength} character long.` // using interpolation to combine Hello my name is Nonye and the length of the character of myName +console.log(greeting);//logs Hello my name is Nonye -console.log(message); diff --git a/exercises/F-strings-methods/exercise2.js b/exercises/F-strings-methods/exercise2.js index b4b46943d..ac808db29 100644 --- a/exercises/F-strings-methods/exercise2.js +++ b/exercises/F-strings-methods/exercise2.js @@ -1,3 +1,10 @@ -const name = " Daniel "; +let myName = "Nonye"; +let myNameLowerCase = myName.toLowerCase(); //change Nonye to nonye +let myNameUpperCase = myName.toUpperCase();//change Nonye to NONYE +let myNameReplace = myName.replace('Nonye', 'Ruth');// Ruth +let myNameLength = myName.length; -console.log(message); +console.log(myNameLowerCase); // "nonye" +console.log(myNameUpperCase);// NONYE +console.log(myNameReplace);// Ruth +console.log(myNameLength); //5 \ No newline at end of file diff --git a/exercises/G-numbers/exercise.js b/exercises/G-numbers/exercise.js index 49e7bc00b..01e785ecf 100644 --- a/exercises/G-numbers/exercise.js +++ b/exercises/G-numbers/exercise.js @@ -1 +1,4 @@ // Start by creating a variables `numberOfStudents` and `numberOfMentors` +let numberOfStudents =15; +let numberOfMentors =8; +let \ No newline at end of file From d6662debddf5dcc5b005221873eff13584958a57 Mon Sep 17 00:00:00 2001 From: GemPearl <65920912+GemPearl@users.noreply.github.com> Date: Mon, 9 Aug 2021 10:34:58 +0100 Subject: [PATCH 2/7] Exercise progress part 2 Exercise G, I and J Completed --- exercises/G-numbers/exercise.js | 6 +++++- exercises/I-floats/exercise.js | 11 +++++++++-- exercises/J-functions/exercise.js | 8 +++----- exercises/J-functions/exercise2.js | 4 ++-- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/exercises/G-numbers/exercise.js b/exercises/G-numbers/exercise.js index 01e785ecf..f3e3497c8 100644 --- a/exercises/G-numbers/exercise.js +++ b/exercises/G-numbers/exercise.js @@ -1,4 +1,8 @@ // Start by creating a variables `numberOfStudents` and `numberOfMentors` let numberOfStudents =15; let numberOfMentors =8; -let \ No newline at end of file +const sum = numberOfMentors + numberOfStudents; + +console.log(`Number of Students: ${numberOfStudents}`); +console.log(`Number of Students: ${numberOfMentors}`); +console.log(`Total number of Students and Mentors: ${sum}`); diff --git a/exercises/I-floats/exercise.js b/exercises/I-floats/exercise.js index a5bbcd852..ad42b4669 100644 --- a/exercises/I-floats/exercise.js +++ b/exercises/I-floats/exercise.js @@ -1,2 +1,9 @@ -var numberOfStudents = 15; -var numberOfMentors = 8; +let numberOfStudents = 15; +let numberOfMentors = 8; +let sum = numberOfMentors + numberOfStudents; +let pStudents = Math.round((numberOfStudents/sum)*100); +let pMentors = Math.round((numberOfMentors/sum)*100); + +console.log(`Percentage of Students: ${pStudents}%`); +console.log(`Percentage of Mentors: ${pMentors}%`); + diff --git a/exercises/J-functions/exercise.js b/exercises/J-functions/exercise.js index 0ae5850e5..aa2afa489 100644 --- a/exercises/J-functions/exercise.js +++ b/exercises/J-functions/exercise.js @@ -1,7 +1,5 @@ function halve(number) { - // complete the function here + return number * 0.5; // complete the function here } - -var result = halve(12); - -console.log(result); +let result = halve(12); +console.log(result); // log 6 diff --git a/exercises/J-functions/exercise2.js b/exercises/J-functions/exercise2.js index 82ef5e780..5e73a10a7 100644 --- a/exercises/J-functions/exercise2.js +++ b/exercises/J-functions/exercise2.js @@ -1,7 +1,7 @@ function triple(number) { - // complete function here + return number*3; // complete function here } var result = triple(12); -console.log(result); +console.log(result);// log 36 From 708b851c969ac6191d329d1c6a69f076a1fe7d24 Mon Sep 17 00:00:00 2001 From: GemPearl <65920912+GemPearl@users.noreply.github.com> Date: Mon, 9 Aug 2021 13:37:26 +0100 Subject: [PATCH 3/7] Exercise Progress Part 3 Exercise G completed --- exercises/K-functions-parameters/exercise.js | 6 +++--- exercises/K-functions-parameters/exercise2.js | 5 ++++- exercises/K-functions-parameters/exercise3.js | 9 +++++---- exercises/K-functions-parameters/exercise4.js | 8 ++++++-- exercises/K-functions-parameters/exercise5.js | 11 +++++++++-- 5 files changed, 27 insertions(+), 12 deletions(-) diff --git a/exercises/K-functions-parameters/exercise.js b/exercises/K-functions-parameters/exercise.js index 8d5db5e69..656a50401 100644 --- a/exercises/K-functions-parameters/exercise.js +++ b/exercises/K-functions-parameters/exercise.js @@ -1,9 +1,9 @@ // Complete the function so that it takes input parameters -function multiply() { - // Calculate the result of the function and return it +function multiply(num1, num2) { + return num1*num2; // Calculate the result of the function and return it } // Assign the result of calling the function the variable `result` -var result = multiply(3, 4); +let result = multiply(3, 4); console.log(result); diff --git a/exercises/K-functions-parameters/exercise2.js b/exercises/K-functions-parameters/exercise2.js index db7a8904b..51fa86f5e 100644 --- a/exercises/K-functions-parameters/exercise2.js +++ b/exercises/K-functions-parameters/exercise2.js @@ -1,5 +1,8 @@ // Declare your function first - +function divide(num1, num2) +{ +return num1/num2; +} var result = divide(3, 4); console.log(result); diff --git a/exercises/K-functions-parameters/exercise3.js b/exercises/K-functions-parameters/exercise3.js index 537e9f4ec..b34a1531d 100644 --- a/exercises/K-functions-parameters/exercise3.js +++ b/exercises/K-functions-parameters/exercise3.js @@ -1,5 +1,6 @@ // Write your function here - -var greeting = createGreeting("Daniel"); - -console.log(greeting); +function greet(myName, middleName)//Hello is a Parameter of the greet function +{ + console.log('Hello, my name is ' + myName + ' ' + middleName); +} +greet('Nonye', 'Ruth'); // Nonye is an arugment of the greet function \ No newline at end of file diff --git a/exercises/K-functions-parameters/exercise4.js b/exercises/K-functions-parameters/exercise4.js index 7ab44589e..feae32069 100644 --- a/exercises/K-functions-parameters/exercise4.js +++ b/exercises/K-functions-parameters/exercise4.js @@ -1,5 +1,9 @@ // Declare your function first - +function add(num1, num2) // Call the function and assign to a variable `sum` +{ +return num1+num2; +} +const result =add(13,124) +console.log(result); -console.log(sum); diff --git a/exercises/K-functions-parameters/exercise5.js b/exercises/K-functions-parameters/exercise5.js index 7c5bcd605..92d5f96ab 100644 --- a/exercises/K-functions-parameters/exercise5.js +++ b/exercises/K-functions-parameters/exercise5.js @@ -1,5 +1,12 @@ +//- Write a function that takes a name (a string) and an age (a number) and returns a greeting (a string) // Declare your function here -const greeting = createLongGreeting("Daniel", 30); +function greet(myName, age) //Hello is a Parameter of the greet function +{ +console.log('Hello, my name is ' + myName + ' and I am ' + age + ` Years old`); +} + +greet ("Nonye", 33); + +//console.log(greeting); -console.log(greeting); From 82d3c6248e7f9737e9c4152aeee1971cff5b8193 Mon Sep 17 00:00:00 2001 From: GemPearl <65920912+GemPearl@users.noreply.github.com> Date: Mon, 9 Aug 2021 14:12:44 +0100 Subject: [PATCH 4/7] Started ExerciseL function code not completed --- exercises/L-functions-nested/exercise.js | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/exercises/L-functions-nested/exercise.js b/exercises/L-functions-nested/exercise.js index a5d377442..63a707653 100644 --- a/exercises/L-functions-nested/exercise.js +++ b/exercises/L-functions-nested/exercise.js @@ -1,5 +1,25 @@ -var mentor1 = "Daniel"; +let mentor1 = "Daniel"; var mentor2 = "Irina"; var mentor3 = "Mimi"; var mentor4 = "Rob"; var mentor5 = "Yohannes"; + +function upperCaseName(mentor1) +{ + let callName = mentor1.toLowerCase; + return callName; +} +console.log(upperCaseName); + + + +// function getAgeInDays(age) { +// return age * 365; +// } + +// function createCreeting(name, age) { +// var ageInDays = getAgeInDays(age); +// var message = +// "My Name is " + name + " and I was born over " + ageInDays + " days ago!"; +// return message; +// } \ No newline at end of file From a03fcfb97aa684b22554815edd792a26850567a7 Mon Sep 17 00:00:00 2001 From: GemPearl <65920912+GemPearl@users.noreply.github.com> Date: Thu, 12 Aug 2021 21:05:04 +0100 Subject: [PATCH 5/7] Mandatory Progress Mandatory Completed --- exercises/B-hello-world/exercise.js | 8 ++++++++ exercises/C-variables/exercise.js | 3 +++ exercises/D-strings/exercise.js | 6 +++++- exercises/E-strings-concatenation/exercise.js | 4 +++- mandatory/1-syntax-errors.js | 13 +++++++------ mandatory/2-logic-error.js | 7 +++---- mandatory/3-function-output.js | 3 +++ mandatory/4-tax.js | 15 +++++++++++++-- 8 files changed, 45 insertions(+), 14 deletions(-) diff --git a/exercises/B-hello-world/exercise.js b/exercises/B-hello-world/exercise.js index b179ee953..55a113136 100644 --- a/exercises/B-hello-world/exercise.js +++ b/exercises/B-hello-world/exercise.js @@ -1 +1,9 @@ console.log("Hello world"); + +console.log("Hello world, I am enjoying my coding journey"); + +console.log(); + +console.log(); + +console.log(); diff --git a/exercises/C-variables/exercise.js b/exercises/C-variables/exercise.js index a6bbb9786..60a11e403 100644 --- a/exercises/C-variables/exercise.js +++ b/exercises/C-variables/exercise.js @@ -1,3 +1,6 @@ // Start by creating a variable `greeting` +let greeting ="Welcome to rewarding journey of JS"; +console.log(greeting); +console.log(greeting); console.log(greeting); diff --git a/exercises/D-strings/exercise.js b/exercises/D-strings/exercise.js index 2cffa6a81..3c07eae56 100644 --- a/exercises/D-strings/exercise.js +++ b/exercises/D-strings/exercise.js @@ -1,3 +1,7 @@ // Start by creating a variable `message` -console.log(message); +let message= "This is a string"; +let messageType = typeof message; //find the data type +console.log(message); //Log 'This is a string' +console.log(messageType);//Log 'string' + diff --git a/exercises/E-strings-concatenation/exercise.js b/exercises/E-strings-concatenation/exercise.js index 2cffa6a81..11aaaaf56 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 myName = "Nonye"; +let greetingstart ="Hello my name is "+ myName; -console.log(message); +console.log(greetingstart); \ No newline at end of file diff --git a/mandatory/1-syntax-errors.js b/mandatory/1-syntax-errors.js index a10cc9ac2..cdbe7e992 100644 --- a/mandatory/1-syntax-errors.js +++ b/mandatory/1-syntax-errors.js @@ -1,16 +1,17 @@ // There are syntax errors in this code - can you fix it to pass the tests? -function addNumbers(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 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"; + total = a + b; + return "The total is " + total; } /* diff --git a/mandatory/2-logic-error.js b/mandatory/2-logic-error.js index 9cca7603b..995910d8d 100644 --- a/mandatory/2-logic-error.js +++ b/mandatory/2-logic-error.js @@ -1,16 +1,15 @@ // The syntax for this function is valid but it has an error, find it and fix it. function trimWord(word) { - return wordtrim(); + return word.trim(); } function getStringLength(word) { - return "word".length(); + return word.length; } function multiply(a, b, c) { - a * b * c; - return; + return a * b * c; } /* diff --git a/mandatory/3-function-output.js b/mandatory/3-function-output.js index 5a953ba60..e0a1e9252 100644 --- a/mandatory/3-function-output.js +++ b/mandatory/3-function-output.js @@ -9,6 +9,9 @@ function combine2Words(word1, word2) { } function concatenate(firstWord, secondWord, thirdWord) { + return firstWord.concat(" "+ 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. } diff --git a/mandatory/4-tax.js b/mandatory/4-tax.js index ba77c7ae2..9ab8c3463 100644 --- a/mandatory/4-tax.js +++ b/mandatory/4-tax.js @@ -4,8 +4,15 @@ A business requires a program that calculates how much the price of a product is including sales tax Sales tax is 20% of the price of the product. */ +// const productPrice; +// const totalSalePrice; + +function calculateSalesTax(price) +{ + // Whatever math is involved to calculate your sales tax here + return price * 1.2; +}; -function calculateSalesTax() {} /* CURRENCY FORMATTING @@ -17,7 +24,11 @@ function calculateSalesTax() {} Remember that the prices must include the sales tax (hint: you already wrote a function for this!) */ -function addTaxAndFormatCurrency() {} +function addTaxAndFormatCurrency(price) { +let newPrice = calculateSalesTax(price); +let newPriceTotal = newPrice.toFixed(2); +return `£${newPriceTotal}`; +} /* =================================================== From b5b49e3db15bce4ecc9432ce8cd818749e814cf1 Mon Sep 17 00:00:00 2001 From: GemPearl <65920912+GemPearl@users.noreply.github.com> Date: Mon, 16 Aug 2021 11:19:56 +0100 Subject: [PATCH 6/7] Exercise G-K restored --- exercises/B-hello-world/exercise.js | 7 ++++ exercises/C-variables/exercise.js | 4 ++ exercises/D-strings/exercise.js | 6 +++ exercises/E-strings-concatenation/exercise.js | 10 ++++- exercises/F-strings-methods/exercise.js | 7 +++- exercises/F-strings-methods/exercise2.js | 11 ++++- exercises/G-numbers/exercise.js | 23 +++++++++++ exercises/I-floats/exercise.js | 15 +++++++ exercises/J-functions/exercise.js | 15 ++++--- exercises/J-functions/exercise2.js | 10 +++-- exercises/K-functions-parameters/exercise.js | 10 +++-- exercises/K-functions-parameters/exercise2.js | 5 ++- exercises/K-functions-parameters/exercise3.js | 13 +++++- exercises/K-functions-parameters/exercise4.js | 12 +++++- exercises/K-functions-parameters/exercise5.js | 19 ++++++++- exercises/L-functions-nested/exercise.js | 40 ++++++++++++++++++- 16 files changed, 185 insertions(+), 22 deletions(-) diff --git a/exercises/B-hello-world/exercise.js b/exercises/B-hello-world/exercise.js index 55a113136..ad3c40f02 100644 --- a/exercises/B-hello-world/exercise.js +++ b/exercises/B-hello-world/exercise.js @@ -1,4 +1,5 @@ console.log("Hello world"); +<<<<<<< HEAD console.log("Hello world, I am enjoying my coding journey"); @@ -7,3 +8,9 @@ console.log(); console.log(); console.log(); +======= +console.log("Hello world, I am enjoying my coding journey"); +console.log() +console.log() +console.log() +>>>>>>> 82d3c6248e7f9737e9c4152aeee1971cff5b8193 diff --git a/exercises/C-variables/exercise.js b/exercises/C-variables/exercise.js index 60a11e403..a6cdc4079 100644 --- a/exercises/C-variables/exercise.js +++ b/exercises/C-variables/exercise.js @@ -1,6 +1,10 @@ // Start by creating a variable `greeting` +<<<<<<< HEAD let greeting ="Welcome to rewarding journey of JS"; +======= +let greeting ="Welcome to rewarding journey of JS" +>>>>>>> 82d3c6248e7f9737e9c4152aeee1971cff5b8193 console.log(greeting); console.log(greeting); console.log(greeting); diff --git a/exercises/D-strings/exercise.js b/exercises/D-strings/exercise.js index 3c07eae56..6532392e1 100644 --- a/exercises/D-strings/exercise.js +++ b/exercises/D-strings/exercise.js @@ -1,7 +1,13 @@ // Start by creating a variable `message` +<<<<<<< HEAD +======= +>>>>>>> 82d3c6248e7f9737e9c4152aeee1971cff5b8193 let message= "This is a string"; let messageType = typeof message; //find the data type console.log(message); //Log 'This is a string' console.log(messageType);//Log 'string' +<<<<<<< HEAD +======= +>>>>>>> 82d3c6248e7f9737e9c4152aeee1971cff5b8193 diff --git a/exercises/E-strings-concatenation/exercise.js b/exercises/E-strings-concatenation/exercise.js index 11aaaaf56..c00c55a0e 100644 --- a/exercises/E-strings-concatenation/exercise.js +++ b/exercises/E-strings-concatenation/exercise.js @@ -1,5 +1,13 @@ // Start by creating a variable `message` +<<<<<<< HEAD let myName = "Nonye"; let greetingstart ="Hello my name is "+ myName; -console.log(greetingstart); \ No newline at end of file +console.log(greetingstart); +======= +let greetingstart ="Hello my name is "; +let myName = "Nonye"; + +let greeting = greetingstart + myName; +console.log(greeting); //logs Hello my name is Nonye +>>>>>>> 82d3c6248e7f9737e9c4152aeee1971cff5b8193 diff --git a/exercises/F-strings-methods/exercise.js b/exercises/F-strings-methods/exercise.js index 2cffa6a81..399bda33e 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 greetingstart ="Hello my name is "; +let myName = "Nonye"; +let nameLength = myName.length;// the length of the character of myName + +let greeting = `${greetingstart} ${myName} and my name is ${nameLength} character long.` // using interpolation to combine Hello my name is Nonye and the length of the character of myName +console.log(greeting);//logs Hello my name is Nonye -console.log(message); diff --git a/exercises/F-strings-methods/exercise2.js b/exercises/F-strings-methods/exercise2.js index b4b46943d..ac808db29 100644 --- a/exercises/F-strings-methods/exercise2.js +++ b/exercises/F-strings-methods/exercise2.js @@ -1,3 +1,10 @@ -const name = " Daniel "; +let myName = "Nonye"; +let myNameLowerCase = myName.toLowerCase(); //change Nonye to nonye +let myNameUpperCase = myName.toUpperCase();//change Nonye to NONYE +let myNameReplace = myName.replace('Nonye', 'Ruth');// Ruth +let myNameLength = myName.length; -console.log(message); +console.log(myNameLowerCase); // "nonye" +console.log(myNameUpperCase);// NONYE +console.log(myNameReplace);// Ruth +console.log(myNameLength); //5 \ No newline at end of file diff --git a/exercises/G-numbers/exercise.js b/exercises/G-numbers/exercise.js index 49e7bc00b..7e4abc50a 100644 --- a/exercises/G-numbers/exercise.js +++ b/exercises/G-numbers/exercise.js @@ -1 +1,24 @@ // Start by creating a variables `numberOfStudents` and `numberOfMentors` +<<<<<<< HEAD + +let numberOfStudents = 15; +let numberOfMentors = 8; +let sum = numberOfMentors + numberOfStudents; + +let pStudents = Math.round((numberOfStudents/sum)*100); + +let pMentors = Math.round((numberOfMentors/sum)*100); + +======= +let numberOfStudents =15; +let numberOfMentors =8; +const sum = numberOfMentors + numberOfStudents; +>>>>>>> 82d3c6248e7f9737e9c4152aeee1971cff5b8193 + +console.log(`Number of Students: ${numberOfStudents}`); +console.log(`Number of Students: ${numberOfMentors}`); +console.log(`Total number of Students and Mentors: ${sum}`); +<<<<<<< HEAD + +======= +>>>>>>> 82d3c6248e7f9737e9c4152aeee1971cff5b8193 diff --git a/exercises/I-floats/exercise.js b/exercises/I-floats/exercise.js index a5bbcd852..36a2f8838 100644 --- a/exercises/I-floats/exercise.js +++ b/exercises/I-floats/exercise.js @@ -1,2 +1,17 @@ +<<<<<<< HEAD var numberOfStudents = 15; var numberOfMentors = 8; +======= +let numberOfStudents = 15; +let numberOfMentors = 8; +>>>>>>> 82d3c6248e7f9737e9c4152aeee1971cff5b8193 +let sum = numberOfMentors + numberOfStudents; +let pStudents = Math.round((numberOfStudents/sum)*100); +let pMentors = Math.round((numberOfMentors/sum)*100); + +console.log(`Percentage of Students: ${pStudents}%`); +console.log(`Percentage of Mentors: ${pMentors}%`); +<<<<<<< HEAD +======= + +>>>>>>> 82d3c6248e7f9737e9c4152aeee1971cff5b8193 diff --git a/exercises/J-functions/exercise.js b/exercises/J-functions/exercise.js index 0ae5850e5..de32616cb 100644 --- a/exercises/J-functions/exercise.js +++ b/exercises/J-functions/exercise.js @@ -1,7 +1,12 @@ function halve(number) { - // complete the function here +<<<<<<< HEAD +return number * 0.5; // complete the function here +let result = halve(12); +console.log(result); // log 6 } - -var result = halve(12); - -console.log(result); +======= + return number * 0.5; // complete the function here +} +let result = halve(12); +console.log(result); // log 6 +>>>>>>> 82d3c6248e7f9737e9c4152aeee1971cff5b8193 diff --git a/exercises/J-functions/exercise2.js b/exercises/J-functions/exercise2.js index 82ef5e780..be3f47eed 100644 --- a/exercises/J-functions/exercise2.js +++ b/exercises/J-functions/exercise2.js @@ -1,7 +1,11 @@ function triple(number) { - // complete function here +<<<<<<< HEAD + return number*3; // complete function here +======= + return number*3; // complete function here +>>>>>>> 82d3c6248e7f9737e9c4152aeee1971cff5b8193 } -var result = triple(12); +let result = triple(12); -console.log(result); +console.log(result);// log 36 diff --git a/exercises/K-functions-parameters/exercise.js b/exercises/K-functions-parameters/exercise.js index 8d5db5e69..848c9eb3e 100644 --- a/exercises/K-functions-parameters/exercise.js +++ b/exercises/K-functions-parameters/exercise.js @@ -1,9 +1,13 @@ // Complete the function so that it takes input parameters -function multiply() { - // Calculate the result of the function and return it +function multiply(num1, num2) { +<<<<<<< HEAD + return num1*num2; // Calculate the result of the function and return it +======= + return num1*num2; // Calculate the result of the function and return it +>>>>>>> 82d3c6248e7f9737e9c4152aeee1971cff5b8193 } // Assign the result of calling the function the variable `result` -var result = multiply(3, 4); +let result = multiply(3, 4); console.log(result); diff --git a/exercises/K-functions-parameters/exercise2.js b/exercises/K-functions-parameters/exercise2.js index db7a8904b..51fa86f5e 100644 --- a/exercises/K-functions-parameters/exercise2.js +++ b/exercises/K-functions-parameters/exercise2.js @@ -1,5 +1,8 @@ // Declare your function first - +function divide(num1, num2) +{ +return num1/num2; +} var result = divide(3, 4); console.log(result); diff --git a/exercises/K-functions-parameters/exercise3.js b/exercises/K-functions-parameters/exercise3.js index 537e9f4ec..4421435ae 100644 --- a/exercises/K-functions-parameters/exercise3.js +++ b/exercises/K-functions-parameters/exercise3.js @@ -1,5 +1,16 @@ // Write your function here +<<<<<<< HEAD -var greeting = createGreeting("Daniel"); +======= +>>>>>>> 82d3c6248e7f9737e9c4152aeee1971cff5b8193 +function greet(myName, middleName)//Hello is a Parameter of the greet function +{ + console.log('Hello, my name is ' + myName + ' ' + middleName); +} +<<<<<<< HEAD +greet('Nonye', 'Ruth'); // Nonye is an arugment of the greet function console.log(greeting); +======= +greet('Nonye', 'Ruth'); // Nonye is an arugment of the greet function +>>>>>>> 82d3c6248e7f9737e9c4152aeee1971cff5b8193 diff --git a/exercises/K-functions-parameters/exercise4.js b/exercises/K-functions-parameters/exercise4.js index 7ab44589e..6fa711049 100644 --- a/exercises/K-functions-parameters/exercise4.js +++ b/exercises/K-functions-parameters/exercise4.js @@ -1,5 +1,13 @@ // Declare your function first - +function add(num1, num2) // Call the function and assign to a variable `sum` +{ +return num1+num2; +} +const result =add(13,124) +console.log(result); +<<<<<<< HEAD + +======= +>>>>>>> 82d3c6248e7f9737e9c4152aeee1971cff5b8193 -console.log(sum); diff --git a/exercises/K-functions-parameters/exercise5.js b/exercises/K-functions-parameters/exercise5.js index 7c5bcd605..95b598ad7 100644 --- a/exercises/K-functions-parameters/exercise5.js +++ b/exercises/K-functions-parameters/exercise5.js @@ -1,5 +1,20 @@ +//- Write a function that takes a name (a string) and an age (a number) and returns a greeting (a string) // Declare your function here +<<<<<<< HEAD +function greet(myName, age) {//Hello is a Parameter of the greet function +console.log('Hello, my name is ' + myName + ' and I am ' + age + ` Years old`); +} +greet ("Nonye", 33); +console.log(greeting); +======= -const greeting = createLongGreeting("Daniel", 30); +function greet(myName, age) //Hello is a Parameter of the greet function +{ +console.log('Hello, my name is ' + myName + ' and I am ' + age + ` Years old`); +} -console.log(greeting); +greet ("Nonye", 33); + +//console.log(greeting); + +>>>>>>> 82d3c6248e7f9737e9c4152aeee1971cff5b8193 diff --git a/exercises/L-functions-nested/exercise.js b/exercises/L-functions-nested/exercise.js index a5d377442..37a6bc8a0 100644 --- a/exercises/L-functions-nested/exercise.js +++ b/exercises/L-functions-nested/exercise.js @@ -1,5 +1,43 @@ -var mentor1 = "Daniel"; +let mentor1 = "Daniel"; var mentor2 = "Irina"; var mentor3 = "Mimi"; var mentor4 = "Rob"; var mentor5 = "Yohannes"; + +<<<<<<< HEAD +function upperCaseName(mentor) +{ + return mentor.toLowerCase; +} + +function shoutGreeting(mentor) +{ + let greeting = 'Hello'; + return greeting + upperCaseName(mentor) +} +console.log(shoutGreeting(mentor1)); +console.log(shoutGreeting(mentor2)); +console.log(shoutGreeting(mentor3)); +console.log(shoutGreeting(mentor4)); +console.log(shoutGreeting(mentor5)); +======= +function upperCaseName(mentor1) +{ + let callName = mentor1.toLowerCase; + return callName; +} +console.log(upperCaseName); + + + +// function getAgeInDays(age) { +// return age * 365; +// } + +// function createCreeting(name, age) { +// var ageInDays = getAgeInDays(age); +// var message = +// "My Name is " + name + " and I was born over " + ageInDays + " days ago!"; +// return message; +// } +>>>>>>> 82d3c6248e7f9737e9c4152aeee1971cff5b8193 From 48134b64e0f9c4f00b7412c28040c1a26c7bd03b Mon Sep 17 00:00:00 2001 From: GemPearl <65920912+GemPearl@users.noreply.github.com> Date: Mon, 16 Aug 2021 11:26:02 +0100 Subject: [PATCH 7/7] Exercise Restored to new Repository --- exercises/B-hello-world/exercise.js | 7 ------ exercises/C-variables/exercise.js | 4 ---- exercises/D-strings/exercise.js | 8 ------- exercises/E-strings-concatenation/exercise.js | 8 ------- exercises/I-floats/exercise.js | 9 -------- exercises/J-functions/exercise.js | 7 ------ exercises/J-functions/exercise2.js | 4 ---- exercises/K-functions-parameters/exercise.js | 4 ---- exercises/K-functions-parameters/exercise3.js | 4 ---- exercises/K-functions-parameters/exercise4.js | 4 ---- exercises/K-functions-parameters/exercise5.js | 13 ----------- exercises/L-functions-nested/exercise.js | 22 ------------------- 12 files changed, 94 deletions(-) diff --git a/exercises/B-hello-world/exercise.js b/exercises/B-hello-world/exercise.js index ad3c40f02..55a113136 100644 --- a/exercises/B-hello-world/exercise.js +++ b/exercises/B-hello-world/exercise.js @@ -1,5 +1,4 @@ console.log("Hello world"); -<<<<<<< HEAD console.log("Hello world, I am enjoying my coding journey"); @@ -8,9 +7,3 @@ console.log(); console.log(); console.log(); -======= -console.log("Hello world, I am enjoying my coding journey"); -console.log() -console.log() -console.log() ->>>>>>> 82d3c6248e7f9737e9c4152aeee1971cff5b8193 diff --git a/exercises/C-variables/exercise.js b/exercises/C-variables/exercise.js index a6cdc4079..60a11e403 100644 --- a/exercises/C-variables/exercise.js +++ b/exercises/C-variables/exercise.js @@ -1,10 +1,6 @@ // Start by creating a variable `greeting` -<<<<<<< HEAD let greeting ="Welcome to rewarding journey of JS"; -======= -let greeting ="Welcome to rewarding journey of JS" ->>>>>>> 82d3c6248e7f9737e9c4152aeee1971cff5b8193 console.log(greeting); console.log(greeting); console.log(greeting); diff --git a/exercises/D-strings/exercise.js b/exercises/D-strings/exercise.js index 6532392e1..7250960c2 100644 --- a/exercises/D-strings/exercise.js +++ b/exercises/D-strings/exercise.js @@ -1,13 +1,5 @@ // Start by creating a variable `message` -<<<<<<< HEAD - -======= ->>>>>>> 82d3c6248e7f9737e9c4152aeee1971cff5b8193 let message= "This is a string"; let messageType = typeof message; //find the data type console.log(message); //Log 'This is a string' console.log(messageType);//Log 'string' -<<<<<<< HEAD - -======= ->>>>>>> 82d3c6248e7f9737e9c4152aeee1971cff5b8193 diff --git a/exercises/E-strings-concatenation/exercise.js b/exercises/E-strings-concatenation/exercise.js index c00c55a0e..21c9eb61f 100644 --- a/exercises/E-strings-concatenation/exercise.js +++ b/exercises/E-strings-concatenation/exercise.js @@ -1,13 +1,5 @@ // Start by creating a variable `message` -<<<<<<< HEAD let myName = "Nonye"; let greetingstart ="Hello my name is "+ myName; console.log(greetingstart); -======= -let greetingstart ="Hello my name is "; -let myName = "Nonye"; - -let greeting = greetingstart + myName; -console.log(greeting); //logs Hello my name is Nonye ->>>>>>> 82d3c6248e7f9737e9c4152aeee1971cff5b8193 diff --git a/exercises/I-floats/exercise.js b/exercises/I-floats/exercise.js index 36a2f8838..628efabda 100644 --- a/exercises/I-floats/exercise.js +++ b/exercises/I-floats/exercise.js @@ -1,17 +1,8 @@ -<<<<<<< HEAD var numberOfStudents = 15; var numberOfMentors = 8; -======= -let numberOfStudents = 15; -let numberOfMentors = 8; ->>>>>>> 82d3c6248e7f9737e9c4152aeee1971cff5b8193 let sum = numberOfMentors + numberOfStudents; let pStudents = Math.round((numberOfStudents/sum)*100); let pMentors = Math.round((numberOfMentors/sum)*100); console.log(`Percentage of Students: ${pStudents}%`); console.log(`Percentage of Mentors: ${pMentors}%`); -<<<<<<< HEAD -======= - ->>>>>>> 82d3c6248e7f9737e9c4152aeee1971cff5b8193 diff --git a/exercises/J-functions/exercise.js b/exercises/J-functions/exercise.js index de32616cb..4e9e742cb 100644 --- a/exercises/J-functions/exercise.js +++ b/exercises/J-functions/exercise.js @@ -1,12 +1,5 @@ function halve(number) { -<<<<<<< HEAD return number * 0.5; // complete the function here let result = halve(12); console.log(result); // log 6 } -======= - return number * 0.5; // complete the function here -} -let result = halve(12); -console.log(result); // log 6 ->>>>>>> 82d3c6248e7f9737e9c4152aeee1971cff5b8193 diff --git a/exercises/J-functions/exercise2.js b/exercises/J-functions/exercise2.js index be3f47eed..a99c3732a 100644 --- a/exercises/J-functions/exercise2.js +++ b/exercises/J-functions/exercise2.js @@ -1,9 +1,5 @@ function triple(number) { -<<<<<<< HEAD return number*3; // complete function here -======= - return number*3; // complete function here ->>>>>>> 82d3c6248e7f9737e9c4152aeee1971cff5b8193 } let result = triple(12); diff --git a/exercises/K-functions-parameters/exercise.js b/exercises/K-functions-parameters/exercise.js index 848c9eb3e..4e649ad0a 100644 --- a/exercises/K-functions-parameters/exercise.js +++ b/exercises/K-functions-parameters/exercise.js @@ -1,10 +1,6 @@ // Complete the function so that it takes input parameters function multiply(num1, num2) { -<<<<<<< HEAD return num1*num2; // Calculate the result of the function and return it -======= - return num1*num2; // Calculate the result of the function and return it ->>>>>>> 82d3c6248e7f9737e9c4152aeee1971cff5b8193 } // Assign the result of calling the function the variable `result` diff --git a/exercises/K-functions-parameters/exercise3.js b/exercises/K-functions-parameters/exercise3.js index 4421435ae..bf83f4108 100644 --- a/exercises/K-functions-parameters/exercise3.js +++ b/exercises/K-functions-parameters/exercise3.js @@ -1,8 +1,4 @@ // Write your function here -<<<<<<< HEAD - -======= ->>>>>>> 82d3c6248e7f9737e9c4152aeee1971cff5b8193 function greet(myName, middleName)//Hello is a Parameter of the greet function { console.log('Hello, my name is ' + myName + ' ' + middleName); diff --git a/exercises/K-functions-parameters/exercise4.js b/exercises/K-functions-parameters/exercise4.js index 6fa711049..feae32069 100644 --- a/exercises/K-functions-parameters/exercise4.js +++ b/exercises/K-functions-parameters/exercise4.js @@ -6,8 +6,4 @@ return num1+num2; } const result =add(13,124) console.log(result); -<<<<<<< HEAD - -======= ->>>>>>> 82d3c6248e7f9737e9c4152aeee1971cff5b8193 diff --git a/exercises/K-functions-parameters/exercise5.js b/exercises/K-functions-parameters/exercise5.js index 95b598ad7..34d49a254 100644 --- a/exercises/K-functions-parameters/exercise5.js +++ b/exercises/K-functions-parameters/exercise5.js @@ -1,20 +1,7 @@ //- Write a function that takes a name (a string) and an age (a number) and returns a greeting (a string) // Declare your function here -<<<<<<< HEAD function greet(myName, age) {//Hello is a Parameter of the greet function console.log('Hello, my name is ' + myName + ' and I am ' + age + ` Years old`); } greet ("Nonye", 33); console.log(greeting); -======= - -function greet(myName, age) //Hello is a Parameter of the greet function -{ -console.log('Hello, my name is ' + myName + ' and I am ' + age + ` Years old`); -} - -greet ("Nonye", 33); - -//console.log(greeting); - ->>>>>>> 82d3c6248e7f9737e9c4152aeee1971cff5b8193 diff --git a/exercises/L-functions-nested/exercise.js b/exercises/L-functions-nested/exercise.js index 37a6bc8a0..38f4cc001 100644 --- a/exercises/L-functions-nested/exercise.js +++ b/exercises/L-functions-nested/exercise.js @@ -4,7 +4,6 @@ var mentor3 = "Mimi"; var mentor4 = "Rob"; var mentor5 = "Yohannes"; -<<<<<<< HEAD function upperCaseName(mentor) { return mentor.toLowerCase; @@ -20,24 +19,3 @@ console.log(shoutGreeting(mentor2)); console.log(shoutGreeting(mentor3)); console.log(shoutGreeting(mentor4)); console.log(shoutGreeting(mentor5)); -======= -function upperCaseName(mentor1) -{ - let callName = mentor1.toLowerCase; - return callName; -} -console.log(upperCaseName); - - - -// function getAgeInDays(age) { -// return age * 365; -// } - -// function createCreeting(name, age) { -// var ageInDays = getAgeInDays(age); -// var message = -// "My Name is " + name + " and I was born over " + ageInDays + " days ago!"; -// return message; -// } ->>>>>>> 82d3c6248e7f9737e9c4152aeee1971cff5b8193