From aeba164e54d5106777119696e9d1cf6b2b3987f7 Mon Sep 17 00:00:00 2001 From: Sayeed Hussain Date: Wed, 17 Jun 2026 12:11:27 +0100 Subject: [PATCH 01/27] Explained what line 3 is doing --- Sprint-1/1-key-exercises/1-count.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Sprint-1/1-key-exercises/1-count.js b/Sprint-1/1-key-exercises/1-count.js index 117bcb2b6e..484eb730c5 100644 --- a/Sprint-1/1-key-exercises/1-count.js +++ b/Sprint-1/1-key-exercises/1-count.js @@ -4,3 +4,5 @@ count = count + 1; // Line 1 is a variable declaration, creating the count variable with an initial value of 0 // Describe what line 3 is doing, in particular focus on what = is doing + +// Line 3 increases the number by one and reassigns new value to count, which stored 0./// From bf0aa4984f4f6bfe6008d3c66d092e4db7164f3d Mon Sep 17 00:00:00 2001 From: Sayeed Hussain Date: Fri, 26 Jun 2026 11:04:25 +0100 Subject: [PATCH 02/27] Fix syntax error --- Sprint-2/1-key-errors/0.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Sprint-2/1-key-errors/0.js b/Sprint-2/1-key-errors/0.js index 653d6f5a07..287e3f3e9b 100644 --- a/Sprint-2/1-key-errors/0.js +++ b/Sprint-2/1-key-errors/0.js @@ -4,10 +4,21 @@ // call the function capitalise with a string input // interpret the error message and figure out why an error is occurring +//////// error code ///// + +// function capitalise(str) { +// let str = `${str[0].toUpperCase()}${str.slice(1)}`; +// return str; +// } + +// fix code // function capitalise(str) { - let str = `${str[0].toUpperCase()}${str.slice(1)}`; - return str; + let string = `${str[0].toUpperCase()}${str.slice(1)}`; + return string; } +console.log(capitalise("hello js error")); // =============> write your explanation here // =============> write your new code here + +// The Error was syntax error as "str" has already been declared and we can't declare it again as variable name. Now I declare a new variable name and assign value. From f09ff4b659ea9adb07fd96bb391f4bed567537f2 Mon Sep 17 00:00:00 2001 From: Sayeed Hussain Date: Fri, 26 Jun 2026 18:33:50 +0100 Subject: [PATCH 03/27] fix syntax error and define erro --- Sprint-2/1-key-errors/1.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Sprint-2/1-key-errors/1.js b/Sprint-2/1-key-errors/1.js index f2d56151f4..d5afc4cd60 100644 --- a/Sprint-2/1-key-errors/1.js +++ b/Sprint-2/1-key-errors/1.js @@ -3,16 +3,18 @@ // Why will an error occur when this program runs? // =============> write your prediction here +// There will be two errors, First syntax errors as decimalNumber has already been declared and tried to redeclare it again inside function. +// second without defining decimalNumber try to use decimalNumber in log. + // Try playing computer with the example to work out what is going on function convertToPercentage(decimalNumber) { - const decimalNumber = 0.5; const percentage = `${decimalNumber * 100}%`; return percentage; } -console.log(decimalNumber); +console.log(convertToPercentage(0.9)); // =============> write your explanation here From 28dec16aa24746852aa580f539fe4d5168979add Mon Sep 17 00:00:00 2001 From: Sayeed Hussain Date: Fri, 26 Jun 2026 19:03:09 +0100 Subject: [PATCH 04/27] fix syntax error and used valid parameter name --- Sprint-2/1-key-errors/2.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Sprint-2/1-key-errors/2.js b/Sprint-2/1-key-errors/2.js index aad57f7cfe..b79fb9bae2 100644 --- a/Sprint-2/1-key-errors/2.js +++ b/Sprint-2/1-key-errors/2.js @@ -1,4 +1,3 @@ - // Predict and explain first BEFORE you run any code... // this function should square any number but instead we're going to get an error @@ -6,15 +5,20 @@ // =============> write your prediction of the error here function square(3) { - return num * num; + return num * num; } // =============> write the error message here +// SyntaxError: Unexpected number // =============> explain this error message here +// syntax error as function does not allow actual value as a parameter // Finally, correct the code to fix the problem // =============> write your new code here - +function square(num) { + return num * num; +} +console.log(square(2)); From fbc18f9ffde342f622dc3c76f6658222e7818d18 Mon Sep 17 00:00:00 2001 From: Sayeed Hussain Date: Fri, 26 Jun 2026 19:54:32 +0100 Subject: [PATCH 05/27] fixed multiply function to return result --- Sprint-2/2-mandatory-debug/0.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Sprint-2/2-mandatory-debug/0.js b/Sprint-2/2-mandatory-debug/0.js index b27511b417..af864ffb04 100644 --- a/Sprint-2/2-mandatory-debug/0.js +++ b/Sprint-2/2-mandatory-debug/0.js @@ -10,5 +10,12 @@ console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`); // =============> write your explanation here +// first log will show result by multiplying but second log will not show any result instead will show undefined because we did not say the code +// what to do and what should return. + // Finally, correct the code to fix the problem // =============> write your new code here + +function multiply(a, b) { + return a * b; +} From 82ad98f8e21b39e973d7189fea776ef0a21304b8 Mon Sep 17 00:00:00 2001 From: Sayeed Hussain Date: Fri, 26 Jun 2026 20:06:44 +0100 Subject: [PATCH 06/27] fixed sum function to return correct value --- Sprint-2/2-mandatory-debug/1.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Sprint-2/2-mandatory-debug/1.js b/Sprint-2/2-mandatory-debug/1.js index 37cedfbcfd..358cbedd95 100644 --- a/Sprint-2/2-mandatory-debug/1.js +++ b/Sprint-2/2-mandatory-debug/1.js @@ -1,6 +1,8 @@ // Predict and explain first... // =============> write your prediction here +// It will show undefined + function sum(a, b) { return; a + b; @@ -9,5 +11,11 @@ function sum(a, b) { console.log(`The sum of 10 and 32 is ${sum(10, 32)}`); // =============> write your explanation here +// the reason is that I did not write anything inside return that's why return can't find anything to return + // Finally, correct the code to fix the problem // =============> write your new code here + +function sum(a, b) { + return a + b; +} From 9e3b8c1479351e1c930ffb3d2ffa2f91d4b5915e Mon Sep 17 00:00:00 2001 From: Sayeed Hussain Date: Fri, 26 Jun 2026 20:40:28 +0100 Subject: [PATCH 07/27] fix getLastDigit to return last digit of any input number --- Sprint-2/2-mandatory-debug/2.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Sprint-2/2-mandatory-debug/2.js b/Sprint-2/2-mandatory-debug/2.js index 57d3f5dc35..88602f1379 100644 --- a/Sprint-2/2-mandatory-debug/2.js +++ b/Sprint-2/2-mandatory-debug/2.js @@ -2,6 +2,7 @@ // Predict the output of the following code: // =============> Write your prediction here +// I predicted that it will show undefined or fixed number like 3 const num = 103; @@ -15,10 +16,24 @@ console.log(`The last digit of 806 is ${getLastDigit(806)}`); // Now run the code and compare the output to your prediction // =============> write the output here +// The last digit of 42 is 3 +// The last digit of 105 is 3 +// The last digit of 806 is 3 // Explain why the output is the way it is +// num has fix number which is 3 and i return this fix number // =============> write your explanation here +// user want last digit whatever number they put but i set up a fix number which will return that one that's why now i removed fixed number and wrote a parameter in function +// which will contain user number whatever number they put and get the last digit. // Finally, correct the code to fix the problem // =============> write your new code here +function getLastDigit(num) { + return num.toString().slice(-1); +} + +console.log(`The last digit of 42 is ${getLastDigit(42)}`); +console.log(`The last digit of 105 is ${getLastDigit(105)}`); +console.log(`The last digit of 806 is ${getLastDigit(806)}`); + // This program should tell the user the last digit of each number. // Explain why getLastDigit is not working properly - correct the problem From df45294aa81ca13f66acdb738d02e87b40f06e67 Mon Sep 17 00:00:00 2001 From: Sayeed Hussain Date: Fri, 26 Jun 2026 21:08:41 +0100 Subject: [PATCH 08/27] made a bmi calcultor function --- Sprint-2/3-mandatory-implement/1-bmi.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Sprint-2/3-mandatory-implement/1-bmi.js b/Sprint-2/3-mandatory-implement/1-bmi.js index 17b1cbde1b..2075b159ea 100644 --- a/Sprint-2/3-mandatory-implement/1-bmi.js +++ b/Sprint-2/3-mandatory-implement/1-bmi.js @@ -15,5 +15,11 @@ // It should return their Body Mass Index to 1 decimal place function calculateBMI(weight, height) { - // return the BMI of someone based off their weight and height -} \ No newline at end of file + let allHeight = Number(height * height); + let heightWeight = Number(weight / allHeight); + let oneDecimal = heightWeight.toFixed(1); + return oneDecimal; + + // return the BMI of someone based off their weight and height +} +console.log(calculateBMI(78, 1.77)); From 9513e24556e91cf9271ba5a17ad390bc7e9560e6 Mon Sep 17 00:00:00 2001 From: Sayeed Hussain Date: Fri, 26 Jun 2026 21:38:15 +0100 Subject: [PATCH 09/27] wrote a function for upper snakecase --- Sprint-2/3-mandatory-implement/2-cases.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Sprint-2/3-mandatory-implement/2-cases.js b/Sprint-2/3-mandatory-implement/2-cases.js index 5b0ef77ad9..2f665fe52e 100644 --- a/Sprint-2/3-mandatory-implement/2-cases.js +++ b/Sprint-2/3-mandatory-implement/2-cases.js @@ -14,3 +14,9 @@ // You will need to come up with an appropriate name for the function // Use the MDN string documentation to help you find a solution // This might help https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase + +function UpperSnake(string) { + let upper = string.toUpperCase().split(" ").join("_"); + return upper; +} +console.log(UpperSnake("hello py")); From 09bd32f1e7683b03b9e39c8d548f50bf0fa6c0c5 Mon Sep 17 00:00:00 2001 From: Sayeed Hussain Date: Fri, 26 Jun 2026 22:19:38 +0100 Subject: [PATCH 10/27] added function --- Sprint-1/3-mandatory-interpret/3-to-pounds.js | 35 +++++++++++-------- Sprint-2/3-mandatory-implement/3-to-pounds.js | 24 +++++++++++++ 2 files changed, 45 insertions(+), 14 deletions(-) diff --git a/Sprint-1/3-mandatory-interpret/3-to-pounds.js b/Sprint-1/3-mandatory-interpret/3-to-pounds.js index 60c9ace69a..6c83b09fc2 100644 --- a/Sprint-1/3-mandatory-interpret/3-to-pounds.js +++ b/Sprint-1/3-mandatory-interpret/3-to-pounds.js @@ -1,21 +1,28 @@ -const penceString = "399p"; +// const penceString = "399p"; -const penceStringWithoutTrailingP = penceString.substring( - 0, - penceString.length - 1 -); +function toPounds(penceString) { + const penceStringWithoutTrailingP = penceString.substring( + 0, + penceString.length - 1 + ); -const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0"); -const pounds = paddedPenceNumberString.substring( - 0, - paddedPenceNumberString.length - 2 -); + const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0"); + const pounds = paddedPenceNumberString.substring( + 0, + paddedPenceNumberString.length - 2 + ); -const pence = paddedPenceNumberString - .substring(paddedPenceNumberString.length - 2) - .padEnd(2, "0"); + const pence = paddedPenceNumberString + .substring(paddedPenceNumberString.length - 2) + .padEnd(2, "0"); -console.log(`£${pounds}.${pence}`); + let poundPence = `£${pounds}.${pence}`; + + return poundPence; +} +console.log(toPounds("223p")); + +// console.log(`£${pounds}.${pence}`); // This program takes a string representing a price in pence // The program then builds up a string representing the price in pounds diff --git a/Sprint-2/3-mandatory-implement/3-to-pounds.js b/Sprint-2/3-mandatory-implement/3-to-pounds.js index 6265a1a703..1d1527cda0 100644 --- a/Sprint-2/3-mandatory-implement/3-to-pounds.js +++ b/Sprint-2/3-mandatory-implement/3-to-pounds.js @@ -4,3 +4,27 @@ // You will need to declare a function called toPounds with an appropriately named parameter. // You should call this function a number of times to check it works for different inputs + +function toPounds(penceString) { + const penceStringWithoutTrailingP = penceString.substring( + 0, + penceString.length - 1 + ); + + const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0"); + const pounds = paddedPenceNumberString.substring( + 0, + paddedPenceNumberString.length - 2 + ); + + const pence = paddedPenceNumberString + .substring(paddedPenceNumberString.length - 2) + .padEnd(2, "0"); + + let poundPence = `£${pounds}.${pence}`; + + return poundPence; +} +console.log(toPounds("223p")); +console.log(toPounds("43p")); +console.log(toPounds("129p")); From 64a649faf97a76edbb6c12eb540e6e9a50e693c1 Mon Sep 17 00:00:00 2001 From: Sayeed Hussain Date: Fri, 10 Jul 2026 12:56:26 +0100 Subject: [PATCH 11/27] Answered following question in time format --- Sprint-2/4-mandatory-interpret/time-format.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Sprint-2/4-mandatory-interpret/time-format.js b/Sprint-2/4-mandatory-interpret/time-format.js index 17127bc01e..2d6a98d9a8 100644 --- a/Sprint-2/4-mandatory-interpret/time-format.js +++ b/Sprint-2/4-mandatory-interpret/time-format.js @@ -15,6 +15,8 @@ function formatTimeDisplay(seconds) { return `${pad(totalHours)}:${pad(remainingMinutes)}:${pad(remainingSeconds)}`; } +console.log(formatTimeDisplay(61)); + // You will need to play computer with this example - use the Python Visualiser https://pythontutor.com/visualize.html#mode=edit // to help you answer these questions @@ -22,17 +24,22 @@ function formatTimeDisplay(seconds) { // a) When formatTimeDisplay is called how many times will pad be called? // =============> write your answer here +// Answer : three times // Call formatTimeDisplay with an input of 61, now answer the following: // b) What is the value assigned to num when pad is called for the first time? // =============> write your answer here +// answer : 0 // c) What is the return value of pad is called for the first time? // =============> write your answer here +// Answer : 00 // d) What is the value assigned to num when pad is called for the last time in this program? Explain your answer // =============> write your answer here - +// answer : 1 and when pad is called, it is called remainingSecond as argument. when formatDisplay runs(61) then 61 divided by 60 and remaining number is 1,which passed to num, so the value of num is 1. +// // e) What is the return value of pad when it is called for the last time in this program? Explain your answer // =============> write your answer here +// answer: 01. return value is zero one because first received it one then pad formatted this number with two length. From 19b45045fe5145e53857e288f0636073f2cdb3dc Mon Sep 17 00:00:00 2001 From: Sayeed Hussain Date: Fri, 10 Jul 2026 21:17:12 +0100 Subject: [PATCH 12/27] converted 24 clock to 12 and test group of input and adge cases --- Sprint-2/5-stretch-extend/format-time.js | 35 ++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/Sprint-2/5-stretch-extend/format-time.js b/Sprint-2/5-stretch-extend/format-time.js index 32a32e66b8..2bbdbf1384 100644 --- a/Sprint-2/5-stretch-extend/format-time.js +++ b/Sprint-2/5-stretch-extend/format-time.js @@ -4,10 +4,16 @@ function formatAs12HourClock(time) { const hours = Number(time.slice(0, 2)); + const mint = time.slice(-2); if (hours > 12) { return `${hours - 12}:00 pm`; + } else if (hours === 0) { + return `12:${mint} am`; + } else if (hours === 12) { + return `12:${mint} pm`; + } else { + return `${time} am`; } - return `${time} am`; } const currentOutput = formatAs12HourClock("08:00"); @@ -16,10 +22,35 @@ console.assert( currentOutput === targetOutput, `current output: ${currentOutput}, target output: ${targetOutput}` ); - const currentOutput2 = formatAs12HourClock("23:00"); const targetOutput2 = "11:00 pm"; console.assert( currentOutput2 === targetOutput2, `current output: ${currentOutput2}, target output: ${targetOutput2}` ); + +const currentOutput3 = formatAs12HourClock("00:00"); +const targetOutput3 = "12:00 am"; +console.assert( + currentOutput3 === targetOutput3, + `current output: ${currentOutput2}, target output: ${targetOutput2}` +); + +const currentOutput4 = formatAs12HourClock("16:00"); +const targetOutput4 = "04:00 pm"; +console.assert( + currentOutput4 === targetOutput4, + `current output: ${currentOutput2}, target output: ${targetOutput2}` +); + +const currentOutput5 = formatAs12HourClock("20:00"); +const targetOutput5 = "08:00 pm"; +console.assert( + currentOutput5 === targetOutput5, + `current output: ${currentOutput2}, target output: ${targetOutput2}` +); + +console.log(formatAs12HourClock("08:00")); +console.log(formatAs12HourClock("23:00")); +console.log(formatAs12HourClock("00:00")); +console.log(formatAs12HourClock("16:00")); From 1f547457af4e63f2e9dd54144ece3e38c6f2e348 Mon Sep 17 00:00:00 2001 From: Sayeed Hussain Date: Sat, 11 Jul 2026 13:31:53 +0100 Subject: [PATCH 13/27] fix original files --- Sprint-1/1-key-exercises/1-count.js | 2 -- Sprint-1/3-mandatory-interpret/3-to-pounds.js | 35 ++++++++----------- 2 files changed, 14 insertions(+), 23 deletions(-) diff --git a/Sprint-1/1-key-exercises/1-count.js b/Sprint-1/1-key-exercises/1-count.js index 484eb730c5..117bcb2b6e 100644 --- a/Sprint-1/1-key-exercises/1-count.js +++ b/Sprint-1/1-key-exercises/1-count.js @@ -4,5 +4,3 @@ count = count + 1; // Line 1 is a variable declaration, creating the count variable with an initial value of 0 // Describe what line 3 is doing, in particular focus on what = is doing - -// Line 3 increases the number by one and reassigns new value to count, which stored 0./// diff --git a/Sprint-1/3-mandatory-interpret/3-to-pounds.js b/Sprint-1/3-mandatory-interpret/3-to-pounds.js index 6c83b09fc2..60c9ace69a 100644 --- a/Sprint-1/3-mandatory-interpret/3-to-pounds.js +++ b/Sprint-1/3-mandatory-interpret/3-to-pounds.js @@ -1,28 +1,21 @@ -// const penceString = "399p"; +const penceString = "399p"; -function toPounds(penceString) { - const penceStringWithoutTrailingP = penceString.substring( - 0, - penceString.length - 1 - ); +const penceStringWithoutTrailingP = penceString.substring( + 0, + penceString.length - 1 +); - const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0"); - const pounds = paddedPenceNumberString.substring( - 0, - paddedPenceNumberString.length - 2 - ); +const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0"); +const pounds = paddedPenceNumberString.substring( + 0, + paddedPenceNumberString.length - 2 +); - const pence = paddedPenceNumberString - .substring(paddedPenceNumberString.length - 2) - .padEnd(2, "0"); +const pence = paddedPenceNumberString + .substring(paddedPenceNumberString.length - 2) + .padEnd(2, "0"); - let poundPence = `£${pounds}.${pence}`; - - return poundPence; -} -console.log(toPounds("223p")); - -// console.log(`£${pounds}.${pence}`); +console.log(`£${pounds}.${pence}`); // This program takes a string representing a price in pence // The program then builds up a string representing the price in pounds From 4cd47495ebfb0fca1fa5af0d2b4a15e3ccede0a3 Mon Sep 17 00:00:00 2001 From: Sahid Hussain Date: Sat, 18 Jul 2026 19:32:24 +0100 Subject: [PATCH 14/27] Implement angle --- .../implement/1-get-angle-type.js | 96 ++++++++++------ .../implement/2-is-proper-fraction.js | 66 +++++------ .../implement/3-get-card-value.js | 108 +++++++++--------- 3 files changed, 146 insertions(+), 124 deletions(-) diff --git a/Sprint-3/1-implement-and-rewrite-tests/implement/1-get-angle-type.js b/Sprint-3/1-implement-and-rewrite-tests/implement/1-get-angle-type.js index 9e05a871e2..89df26cf1a 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/implement/1-get-angle-type.js +++ b/Sprint-3/1-implement-and-rewrite-tests/implement/1-get-angle-type.js @@ -1,37 +1,59 @@ -// Implement a function getAngleType -// -// When given an angle in degrees, it should return a string indicating the type of angle: -// - "Acute angle" for angles greater than 0° and less than 90° -// - "Right angle" for exactly 90° -// - "Obtuse angle" for angles greater than 90° and less than 180° -// - "Straight angle" for exactly 180° -// - "Reflex angle" for angles greater than 180° and less than 360° -// - "Invalid angle" for angles outside the valid range. - -// Assumption: The parameter is a valid number. (You do not need to handle non-numeric inputs.) - -// Acceptance criteria: -// After you have implemented the function, write tests to cover all the cases, and -// execute the code to ensure all tests pass. - -function getAngleType(angle) { - // TODO: Implement this function -} - -// The line below allows us to load the getAngleType function into tests in other files. -// This will be useful in the "rewrite tests with jest" step. -module.exports = getAngleType; - -// This helper function is written to make our assertions easier to read. -// If the actual output matches the target output, the test will pass -function assertEquals(actualOutput, targetOutput) { - console.assert( - actualOutput === targetOutput, - `Expected ${actualOutput} to equal ${targetOutput}` - ); -} - -// TODO: Write tests to cover all cases, including boundary and invalid cases. -// Example: Identify Right Angles -const right = getAngleType(90); -assertEquals(right, "Right angle"); +// Implement a function getAngleType +// +// When given an angle in degrees, it should return a string indicating the type of angle: +// - "Acute angle" for angles greater than 0° and less than 90° +// - "Right angle" for exactly 90° +// - "Obtuse angle" for angles greater than 90° and less than 180° +// - "Straight angle" for exactly 180° +// - "Reflex angle" for angles greater than 180° and less than 360° +// - "Invalid angle" for angles outside the valid range. + +// Assumption: The parameter is a valid number. (You do not need to handle non-numeric inputs.) + +// Acceptance criteria: +// After you have implemented the function, write tests to cover all the cases, and +// execute the code to ensure all tests pass. + +function getAngleType(angle) { + // TODO: Implement this function + if (angle < 90) { + return "Acute angle"; + } + if (angle === 90) { + return "Right angle"; + } + if (angle > 90 && angle < 180) { + return "Obtuse angle"; + } + if (angle === 180) { + return "Straight angle"; + } + if (angle > 180 && angle < 360) { + return "Reflex angle"; + } else { + return "Invalid"; + } +} + +// The line below allows us to load the getAngleType function into tests in other files. +// This will be useful in the "rewrite tests with jest" step. +module.exports = getAngleType; + +// This helper function is written to make our assertions easier to read. +// If the actual output matches the target output, the test will pass +function assertEquals(actualOutput, targetOutput) { + console.assert( + actualOutput === targetOutput, + `Expected ${actualOutput} to equal ${targetOutput}` + ); +} + +// TODO: Write tests to cover all cases, including boundary and invalid cases. +// Example: Identify Right Angles +const right = getAngleType(90); +assertEquals(right, "Right angle"); +assertEquals(getAngleType(45), "Acute angle"); +assertEquals(getAngleType(145), "Obtuse angle"); +assertEquals(getAngleType(180), "Straight angle"); +assertEquals(getAngleType(190), "Reflex angle"); +assertEquals(getAngleType(390), "Invalid"); diff --git a/Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js b/Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js index 970cb9b641..9f3741921f 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js +++ b/Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js @@ -1,33 +1,33 @@ -// Implement a function isProperFraction, -// when given two numbers, a numerator and a denominator, it should return true if -// the given numbers form a proper fraction, and false otherwise. - -// Assumption: The parameters are valid numbers (not NaN or Infinity). - -// Note: If you are unfamiliar with proper fractions, please look up its mathematical definition. - -// Acceptance criteria: -// After you have implemented the function, write tests to cover all the cases, and -// execute the code to ensure all tests pass. - -function isProperFraction(numerator, denominator) { - // TODO: Implement this function -} - -// The line below allows us to load the isProperFraction function into tests in other files. -// This will be useful in the "rewrite tests with jest" step. -module.exports = isProperFraction; - -// Here's our helper again -function assertEquals(actualOutput, targetOutput) { - console.assert( - actualOutput === targetOutput, - `Expected ${actualOutput} to equal ${targetOutput}` - ); -} - -// TODO: Write tests to cover all cases. -// What combinations of numerators and denominators should you test? - -// Example: 1/2 is a proper fraction -assertEquals(isProperFraction(1, 2), true); +// Implement a function isProperFraction, +// when given two numbers, a numerator and a denominator, it should return true if +// the given numbers form a proper fraction, and false otherwise. + +// Assumption: The parameters are valid numbers (not NaN or Infinity). + +// Note: If you are unfamiliar with proper fractions, please look up its mathematical definition. + +// Acceptance criteria: +// After you have implemented the function, write tests to cover all the cases, and +// execute the code to ensure all tests pass. + +function isProperFraction(numerator, denominator) { + // TODO: Implement this function +} + +// The line below allows us to load the isProperFraction function into tests in other files. +// This will be useful in the "rewrite tests with jest" step. +module.exports = isProperFraction; + +// Here's our helper again +function assertEquals(actualOutput, targetOutput) { + console.assert( + actualOutput === targetOutput, + `Expected ${actualOutput} to equal ${targetOutput}` + ); +} + +// TODO: Write tests to cover all cases. +// What combinations of numerators and denominators should you test? + +// Example: 1/2 is a proper fraction +assertEquals(isProperFraction(1, 2), true); diff --git a/Sprint-3/1-implement-and-rewrite-tests/implement/3-get-card-value.js b/Sprint-3/1-implement-and-rewrite-tests/implement/3-get-card-value.js index ff5c532e1d..8b19a3cb1b 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/implement/3-get-card-value.js +++ b/Sprint-3/1-implement-and-rewrite-tests/implement/3-get-card-value.js @@ -1,54 +1,54 @@ -// This problem involves playing cards: https://en.wikipedia.org/wiki/Standard_52-card_deck - -// Implement a function getCardValue, when given a string representing a playing card, -// should return the numerical value of the card. - -// A valid card string will contain a rank followed by the suit. -// The rank can be one of the following strings: -// "A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K" -// The suit can be one of the following emojis: -// "♠", "♥", "♦", "♣" -// For example: "A♠", "2♥", "10♥", "J♣", "Q♦", "K♦". - -// When the card is an ace ("A"), the function should return 11. -// When the card is a face card ("J", "Q", "K"), the function should return 10. -// When the card is a number card ("2" to "10"), the function should return its numeric value. - -// When the card string is invalid (not following the above format), the function should -// throw an error. - -// Acceptance criteria: -// After you have implemented the function, write tests to cover all the cases, and -// execute the code to ensure all tests pass. - -function getCardValue(card) { - // TODO: Implement this function -} - -// The line below allows us to load the getCardValue function into tests in other files. -// This will be useful in the "rewrite tests with jest" step. -module.exports = getCardValue; - -// Helper functions to make our assertions easier to read. -function assertEquals(actualOutput, targetOutput) { - console.assert( - actualOutput === targetOutput, - `Expected ${actualOutput} to equal ${targetOutput}` - ); -} - -// TODO: Write tests to cover all outcomes, including throwing errors for invalid cards. -// Examples: -assertEquals(getCardValue("9♠"), 9); - -// Handling invalid cards -try { - getCardValue("invalid"); - - // This line will not be reached if an error is thrown as expected - console.error("Error was not thrown for invalid card 😢"); -} catch (e) { - console.log("Error thrown for invalid card 🎉"); -} - -// What other invalid card cases can you think of? +// This problem involves playing cards: https://en.wikipedia.org/wiki/Standard_52-card_deck + +// Implement a function getCardValue, when given a string representing a playing card, +// should return the numerical value of the card. + +// A valid card string will contain a rank followed by the suit. +// The rank can be one of the following strings: +// "A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K" +// The suit can be one of the following emojis: +// "♠", "♥", "♦", "♣" +// For example: "A♠", "2♥", "10♥", "J♣", "Q♦", "K♦". + +// When the card is an ace ("A"), the function should return 11. +// When the card is a face card ("J", "Q", "K"), the function should return 10. +// When the card is a number card ("2" to "10"), the function should return its numeric value. + +// When the card string is invalid (not following the above format), the function should +// throw an error. + +// Acceptance criteria: +// After you have implemented the function, write tests to cover all the cases, and +// execute the code to ensure all tests pass. + +function getCardValue(card) { + // TODO: Implement this function +} + +// The line below allows us to load the getCardValue function into tests in other files. +// This will be useful in the "rewrite tests with jest" step. +module.exports = getCardValue; + +// Helper functions to make our assertions easier to read. +function assertEquals(actualOutput, targetOutput) { + console.assert( + actualOutput === targetOutput, + `Expected ${actualOutput} to equal ${targetOutput}` + ); +} + +// TODO: Write tests to cover all outcomes, including throwing errors for invalid cards. +// Examples: +assertEquals(getCardValue("9♠"), 9); + +// Handling invalid cards +try { + getCardValue("invalid"); + + // This line will not be reached if an error is thrown as expected + console.error("Error was not thrown for invalid card 😢"); +} catch (e) { + console.log("Error thrown for invalid card 🎉"); +} + +// What other invalid card cases can you think of? From f86d67dbfe937e940c4289d84cb5e67e1d0ec780 Mon Sep 17 00:00:00 2001 From: Sahid Hussain Date: Sat, 18 Jul 2026 20:24:36 +0100 Subject: [PATCH 15/27] Implemented angle type --- .../1-implement-and-rewrite-tests/implement/1-get-angle-type.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Sprint-3/1-implement-and-rewrite-tests/implement/1-get-angle-type.js b/Sprint-3/1-implement-and-rewrite-tests/implement/1-get-angle-type.js index 89df26cf1a..0693d415b5 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/implement/1-get-angle-type.js +++ b/Sprint-3/1-implement-and-rewrite-tests/implement/1-get-angle-type.js @@ -48,6 +48,7 @@ function assertEquals(actualOutput, targetOutput) { ); } +// cd Sprint-3 cd 1-implement-and-rewrite-tests cd implement // TODO: Write tests to cover all cases, including boundary and invalid cases. // Example: Identify Right Angles const right = getAngleType(90); From c52dab318eea974963c86eca86f052ac7ae2189e Mon Sep 17 00:00:00 2001 From: Sahid Hussain Date: Sat, 18 Jul 2026 21:14:49 +0100 Subject: [PATCH 16/27] Implemented angle type --- .../1-implement-and-rewrite-tests/implement/1-get-angle-type.js | 1 - 1 file changed, 1 deletion(-) diff --git a/Sprint-3/1-implement-and-rewrite-tests/implement/1-get-angle-type.js b/Sprint-3/1-implement-and-rewrite-tests/implement/1-get-angle-type.js index 0693d415b5..89df26cf1a 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/implement/1-get-angle-type.js +++ b/Sprint-3/1-implement-and-rewrite-tests/implement/1-get-angle-type.js @@ -48,7 +48,6 @@ function assertEquals(actualOutput, targetOutput) { ); } -// cd Sprint-3 cd 1-implement-and-rewrite-tests cd implement // TODO: Write tests to cover all cases, including boundary and invalid cases. // Example: Identify Right Angles const right = getAngleType(90); From e207d39f34195df698ad12c501e12fca6ea091b2 Mon Sep 17 00:00:00 2001 From: Sahid Hussain Date: Mon, 20 Jul 2026 13:08:57 +0100 Subject: [PATCH 17/27] Formed proper fraction --- .../implement/2-is-proper-fraction.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js b/Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js index 9f3741921f..705fa84c90 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js +++ b/Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js @@ -12,6 +12,8 @@ function isProperFraction(numerator, denominator) { // TODO: Implement this function + let fraction = Math.abs(numerator) < Math.abs(denominator); + return fraction; } // The line below allows us to load the isProperFraction function into tests in other files. @@ -31,3 +33,6 @@ function assertEquals(actualOutput, targetOutput) { // Example: 1/2 is a proper fraction assertEquals(isProperFraction(1, 2), true); +assertEquals(isProperFraction(5, 2), false); +assertEquals(isProperFraction(7, 9), true); +assertEquals(isProperFraction(3, -5), true); From 833f4789e76fbb011aeac78ca132afd963c466b5 Mon Sep 17 00:00:00 2001 From: Sahid Hussain Date: Fri, 24 Jul 2026 16:36:44 +0100 Subject: [PATCH 18/27] implemented card value --- .../implement/3-get-card-value.js | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/Sprint-3/1-implement-and-rewrite-tests/implement/3-get-card-value.js b/Sprint-3/1-implement-and-rewrite-tests/implement/3-get-card-value.js index 8b19a3cb1b..6ae3492ef6 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/implement/3-get-card-value.js +++ b/Sprint-3/1-implement-and-rewrite-tests/implement/3-get-card-value.js @@ -23,6 +23,40 @@ function getCardValue(card) { // TODO: Implement this function + + const ranks = [ + "A", + "2", + "3", + "4", + "5", + "6", + "7", + "8", + "9", + "10", + "J", + "Q", + "K", + ]; + const suits = ["♠", "♥", "♦", "♣"]; + + const rank1 = card.slice(0, -1); + const suit1 = card.slice(-1); + const IsEqualCard = suits.includes(suit1) && ranks.includes(rank1); + if (!IsEqualCard) { + throw new Error("invalid card "); + } + if (rank1 === "A") { + return 11; + } + if (rank1 === "J" || rank1 === "Q" || rank1 === "K") { + return 10; + } + const numberRanks = Number(rank1); + if (numberRanks >= 2 && numberRanks <= 10) { + return numberRanks; + } } // The line below allows us to load the getCardValue function into tests in other files. @@ -40,6 +74,13 @@ function assertEquals(actualOutput, targetOutput) { // TODO: Write tests to cover all outcomes, including throwing errors for invalid cards. // Examples: assertEquals(getCardValue("9♠"), 9); +assertEquals(getCardValue("10♦"), 10); +assertEquals(getCardValue("7♠"), 7); +assertEquals(getCardValue("8♥"), 8); +assertEquals(getCardValue("A♥"), 11); +assertEquals(getCardValue("J♥"), 10); +assertEquals(getCardValue("Q♥"), 10); +assertEquals(getCardValue("K♥"), 10); // Handling invalid cards try { @@ -51,4 +92,18 @@ try { console.log("Error thrown for invalid card 🎉"); } +try { + getCardValue("1♠"); + console.error("Error was not thrown 😢"); +} catch (e) { + console.log("Error thrown for invalid 🎉"); +} + +try { + getCardValue("error"); + console.error("Error was not thrown 😢"); +} catch (e) { + console.log("Error thrown for invalid 🎉"); +} + // What other invalid card cases can you think of? From 59354759d425c7a13b00187ec3f94ea5c18c0c41 Mon Sep 17 00:00:00 2001 From: Sahid Hussain Date: Tue, 28 Jul 2026 21:52:25 +0100 Subject: [PATCH 19/27] angle type test done --- .../1-get-angle-type.test.js | 65 +++++++++++++------ .../2-is-proper-fraction.test.js | 20 +++--- .../3-get-card-value.test.js | 40 ++++++------ 3 files changed, 75 insertions(+), 50 deletions(-) diff --git a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js index d777f348d3..afa685c184 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js +++ b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js @@ -1,20 +1,45 @@ -// This statement loads the getAngleType function you wrote in the implement directory. -// We will use the same function, but write tests for it using Jest in this file. -const getAngleType = require("../implement/1-get-angle-type"); - -// TODO: Write tests in Jest syntax to cover all cases/outcomes, -// including boundary and invalid cases. - -// Case 1: Acute angles -test(`should return "Acute angle" when (0 < angle < 90)`, () => { - // Test various acute angles, including boundary cases - expect(getAngleType(1)).toEqual("Acute angle"); - expect(getAngleType(45)).toEqual("Acute angle"); - expect(getAngleType(89)).toEqual("Acute angle"); -}); - -// Case 2: Right angle -// Case 3: Obtuse angles -// Case 4: Straight angle -// Case 5: Reflex angles -// Case 6: Invalid angles +// This statement loads the getAngleType function you wrote in the implement directory. +// We will use the same function, but write tests for it using Jest in this file. +const getAngleType = require("../implement/1-get-angle-type"); + +// TODO: Write tests in Jest syntax to cover all cases/outcomes, +// including boundary and invalid cases. + +// Case 1: Acute angles +test(`should return "Acute angle" when ( angle > 0 and angle < 90)`, () => { + // Test various acute angles, including boundary cases + expect(getAngleType(1)).toEqual("Acute angle"); + expect(getAngleType(45)).toEqual("Acute angle"); + expect(getAngleType(89)).toEqual("Acute angle"); +}); + +// Case 2: Right angle +test(`should return "Right angle" when angle exactly equals 90`, () => { + expect(getAngleType(90)).toEqual("Right angle"); +}); + +// Case 3: Obtuse angles +describe(`should return "obtuse angle" when obtuse > 90 and obtuse < 180`, () => { + expect(getAngleType(95)).toEqual("Obtuse angle"); + expect(getAngleType(99)).toEqual("Obtuse angle"); + expect(getAngleType(105)).toEqual("Obtuse angle"); +}); +// Case 4: Straight angle + +test(`should return "straight angle" when straight is equals 180`, () => { + expect(getAngleType(180)).toEqual("Straight angle"); +}); +// Case 5: Reflex angles +test(`should return "reflex angle" if angle is more than 180 and less than 360`, () => { + expect(getAngleType(181)).toEqual("Reflex angle"); + expect(getAngleType(191)).toEqual("Reflex angle"); + expect(getAngleType(211)).toEqual("Reflex angle"); +}); + +// tes(`should return "reflex angle" when straight is `); +// Case 6: Invalid angles +test(`should return "invalid angle" if any of them don't match`, () => { + expect(getAngleType(380)).toEqual("Invalid"); + expect(getAngleType(430)).toEqual("Invalid"); + expect(getAngleType(390)).toEqual("Invalid"); +}); diff --git a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js index 7f087b2ba1..8476a4d251 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js +++ b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js @@ -1,10 +1,10 @@ -// This statement loads the isProperFraction function you wrote in the implement directory. -// We will use the same function, but write tests for it using Jest in this file. -const isProperFraction = require("../implement/2-is-proper-fraction"); - -// TODO: Write tests in Jest syntax to cover all combinations of positives, negatives, zeros, and other categories. - -// Special case: numerator is zero -test(`should return false when denominator is zero`, () => { - expect(isProperFraction(1, 0)).toEqual(false); -}); +// This statement loads the isProperFraction function you wrote in the implement directory. +// We will use the same function, but write tests for it using Jest in this file. +const isProperFraction = require("../implement/2-is-proper-fraction"); + +// TODO: Write tests in Jest syntax to cover all combinations of positives, negatives, zeros, and other categories. + +// Special case: numerator is zero +test(`should return false when denominator is zero`, () => { + expect(isProperFraction(1, 0)).toEqual(false); +}); diff --git a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js index cf7f9dae2e..5d5320be34 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js +++ b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js @@ -1,20 +1,20 @@ -// This statement loads the getCardValue function you wrote in the implement directory. -// We will use the same function, but write tests for it using Jest in this file. -const getCardValue = require("../implement/3-get-card-value"); - -// TODO: Write tests in Jest syntax to cover all possible outcomes. - -// Case 1: Ace (A) -test(`Should return 11 when given an ace card`, () => { - expect(getCardValue("A♠")).toEqual(11); -}); - -// Suggestion: Group the remaining test data into these categories: -// Number Cards (2-10) -// Face Cards (J, Q, K) -// Invalid Cards - -// To learn how to test whether a function throws an error as expected in Jest, -// please refer to the Jest documentation: -// https://jestjs.io/docs/expect#tothrowerror - +// This statement loads the getCardValue function you wrote in the implement directory. +// We will use the same function, but write tests for it using Jest in this file. +const getCardValue = require("../implement/3-get-card-value"); + +// TODO: Write tests in Jest syntax to cover all possible outcomes. + +// Case 1: Ace (A) +test(`Should return 11 when given an ace card`, () => { + expect(getCardValue("A♠")).toEqual(11); +}); + +// Suggestion: Group the remaining test data into these categories: +// Number Cards (2-10) +// Face Cards (J, Q, K) +// Invalid Cards + +// To learn how to test whether a function throws an error as expected in Jest, +// please refer to the Jest documentation: +// https://jestjs.io/docs/expect#tothrowerror + From d6b8042336aadca2823da80af9caeea56a6acaa2 Mon Sep 17 00:00:00 2001 From: Sahid Hussain Date: Tue, 28 Jul 2026 22:09:39 +0100 Subject: [PATCH 20/27] get angle test done --- .../1-get-angle-type.test.js | 65 +++++++++++++------ .../2-is-proper-fraction.test.js | 20 +++--- .../3-get-card-value.test.js | 40 ++++++------ 3 files changed, 75 insertions(+), 50 deletions(-) diff --git a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js index d777f348d3..afa685c184 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js +++ b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js @@ -1,20 +1,45 @@ -// This statement loads the getAngleType function you wrote in the implement directory. -// We will use the same function, but write tests for it using Jest in this file. -const getAngleType = require("../implement/1-get-angle-type"); - -// TODO: Write tests in Jest syntax to cover all cases/outcomes, -// including boundary and invalid cases. - -// Case 1: Acute angles -test(`should return "Acute angle" when (0 < angle < 90)`, () => { - // Test various acute angles, including boundary cases - expect(getAngleType(1)).toEqual("Acute angle"); - expect(getAngleType(45)).toEqual("Acute angle"); - expect(getAngleType(89)).toEqual("Acute angle"); -}); - -// Case 2: Right angle -// Case 3: Obtuse angles -// Case 4: Straight angle -// Case 5: Reflex angles -// Case 6: Invalid angles +// This statement loads the getAngleType function you wrote in the implement directory. +// We will use the same function, but write tests for it using Jest in this file. +const getAngleType = require("../implement/1-get-angle-type"); + +// TODO: Write tests in Jest syntax to cover all cases/outcomes, +// including boundary and invalid cases. + +// Case 1: Acute angles +test(`should return "Acute angle" when ( angle > 0 and angle < 90)`, () => { + // Test various acute angles, including boundary cases + expect(getAngleType(1)).toEqual("Acute angle"); + expect(getAngleType(45)).toEqual("Acute angle"); + expect(getAngleType(89)).toEqual("Acute angle"); +}); + +// Case 2: Right angle +test(`should return "Right angle" when angle exactly equals 90`, () => { + expect(getAngleType(90)).toEqual("Right angle"); +}); + +// Case 3: Obtuse angles +describe(`should return "obtuse angle" when obtuse > 90 and obtuse < 180`, () => { + expect(getAngleType(95)).toEqual("Obtuse angle"); + expect(getAngleType(99)).toEqual("Obtuse angle"); + expect(getAngleType(105)).toEqual("Obtuse angle"); +}); +// Case 4: Straight angle + +test(`should return "straight angle" when straight is equals 180`, () => { + expect(getAngleType(180)).toEqual("Straight angle"); +}); +// Case 5: Reflex angles +test(`should return "reflex angle" if angle is more than 180 and less than 360`, () => { + expect(getAngleType(181)).toEqual("Reflex angle"); + expect(getAngleType(191)).toEqual("Reflex angle"); + expect(getAngleType(211)).toEqual("Reflex angle"); +}); + +// tes(`should return "reflex angle" when straight is `); +// Case 6: Invalid angles +test(`should return "invalid angle" if any of them don't match`, () => { + expect(getAngleType(380)).toEqual("Invalid"); + expect(getAngleType(430)).toEqual("Invalid"); + expect(getAngleType(390)).toEqual("Invalid"); +}); diff --git a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js index 7f087b2ba1..8476a4d251 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js +++ b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js @@ -1,10 +1,10 @@ -// This statement loads the isProperFraction function you wrote in the implement directory. -// We will use the same function, but write tests for it using Jest in this file. -const isProperFraction = require("../implement/2-is-proper-fraction"); - -// TODO: Write tests in Jest syntax to cover all combinations of positives, negatives, zeros, and other categories. - -// Special case: numerator is zero -test(`should return false when denominator is zero`, () => { - expect(isProperFraction(1, 0)).toEqual(false); -}); +// This statement loads the isProperFraction function you wrote in the implement directory. +// We will use the same function, but write tests for it using Jest in this file. +const isProperFraction = require("../implement/2-is-proper-fraction"); + +// TODO: Write tests in Jest syntax to cover all combinations of positives, negatives, zeros, and other categories. + +// Special case: numerator is zero +test(`should return false when denominator is zero`, () => { + expect(isProperFraction(1, 0)).toEqual(false); +}); diff --git a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js index cf7f9dae2e..5d5320be34 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js +++ b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js @@ -1,20 +1,20 @@ -// This statement loads the getCardValue function you wrote in the implement directory. -// We will use the same function, but write tests for it using Jest in this file. -const getCardValue = require("../implement/3-get-card-value"); - -// TODO: Write tests in Jest syntax to cover all possible outcomes. - -// Case 1: Ace (A) -test(`Should return 11 when given an ace card`, () => { - expect(getCardValue("A♠")).toEqual(11); -}); - -// Suggestion: Group the remaining test data into these categories: -// Number Cards (2-10) -// Face Cards (J, Q, K) -// Invalid Cards - -// To learn how to test whether a function throws an error as expected in Jest, -// please refer to the Jest documentation: -// https://jestjs.io/docs/expect#tothrowerror - +// This statement loads the getCardValue function you wrote in the implement directory. +// We will use the same function, but write tests for it using Jest in this file. +const getCardValue = require("../implement/3-get-card-value"); + +// TODO: Write tests in Jest syntax to cover all possible outcomes. + +// Case 1: Ace (A) +test(`Should return 11 when given an ace card`, () => { + expect(getCardValue("A♠")).toEqual(11); +}); + +// Suggestion: Group the remaining test data into these categories: +// Number Cards (2-10) +// Face Cards (J, Q, K) +// Invalid Cards + +// To learn how to test whether a function throws an error as expected in Jest, +// please refer to the Jest documentation: +// https://jestjs.io/docs/expect#tothrowerror + From 0b6ad14b031ccbc6034bc4511346ec99602eff6f Mon Sep 17 00:00:00 2001 From: Sahid Hussain Date: Tue, 28 Jul 2026 22:18:21 +0100 Subject: [PATCH 21/27] get angle test done --- .../rewrite-tests-with-jest/1-get-angle-type.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js index afa685c184..7d0073ee87 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js +++ b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/1-get-angle-type.test.js @@ -39,7 +39,7 @@ test(`should return "reflex angle" if angle is more than 180 and less than 360`, // tes(`should return "reflex angle" when straight is `); // Case 6: Invalid angles test(`should return "invalid angle" if any of them don't match`, () => { - expect(getAngleType(380)).toEqual("Invalid"); + expect(getAngleType(385)).toEqual("Invalid"); expect(getAngleType(430)).toEqual("Invalid"); expect(getAngleType(390)).toEqual("Invalid"); }); From bd91f3bdaecc167b95474e65cd9701786f8f3ec9 Mon Sep 17 00:00:00 2001 From: Sahid Hussain Date: Wed, 29 Jul 2026 11:56:50 +0100 Subject: [PATCH 22/27] proper fraction test implementation done --- .../2-is-proper-fraction.test.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js index 8476a4d251..98be5f25d8 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js +++ b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js @@ -8,3 +8,18 @@ const isProperFraction = require("../implement/2-is-proper-fraction"); test(`should return false when denominator is zero`, () => { expect(isProperFraction(1, 0)).toEqual(false); }); +test(`should return true when denominator is 5`, () => { + expect(isProperFraction(2, 5)).toEqual(true); +}); + +test(`should return true when denominator is 10`, () => { + expect(isProperFraction(4, 10)).toEqual(true); +}); + +test(`should return false when denominator is -1`, () => { + expect(isProperFraction(3, -1)).toEqual(false); +}); + +test(`should return false when denominator is 0`, () => { + expect(isProperFraction(5, 0)).toEqual(false); +}); From 9cf30f5d8c3a4f6b69043c7a3dfb34531c57e8f0 Mon Sep 17 00:00:00 2001 From: Sahid Hussain Date: Wed, 29 Jul 2026 13:21:23 +0100 Subject: [PATCH 23/27] card value test implementation done --- .../3-get-card-value.test.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js index 5d5320be34..57bd088666 100644 --- a/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js +++ b/Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js @@ -11,10 +11,26 @@ test(`Should return 11 when given an ace card`, () => { // Suggestion: Group the remaining test data into these categories: // Number Cards (2-10) +test(`Should return 9,6,4,2 when given a card number`, () => { + expect(getCardValue("9♠")).toEqual(9); + expect(getCardValue("6♠")).toEqual(6); + expect(getCardValue("4♠")).toEqual(4); + expect(getCardValue("2♠")).toEqual(2); +}); // Face Cards (J, Q, K) + +test(`should return 10 when given face card `, () => { + expect(getCardValue("J♥")).toEqual(10); + expect(getCardValue("Q♥")).toEqual(10); + expect(getCardValue("K♥")).toEqual(10); +}); // Invalid Cards +test(`should return invalid when given a invalid input`, () => { + expect(() => { + getCardValue("invalid"); + }).toThrow(); +}); // To learn how to test whether a function throws an error as expected in Jest, // please refer to the Jest documentation: // https://jestjs.io/docs/expect#tothrowerror - From d3ca5ad3347393fcf5c2a4cac9809033de0f215a Mon Sep 17 00:00:00 2001 From: Sayeed Hussain Date: Wed, 29 Jul 2026 14:52:17 +0100 Subject: [PATCH 24/27] try to fix --- Sprint-1/1-key-exercises/2-initials.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Sprint-1/1-key-exercises/2-initials.js b/Sprint-1/1-key-exercises/2-initials.js index 47561f6175..3c0d5d3a7c 100644 --- a/Sprint-1/1-key-exercises/2-initials.js +++ b/Sprint-1/1-key-exercises/2-initials.js @@ -5,7 +5,9 @@ let lastName = "Johnson"; // Declare a variable called initials that stores the first character of each string. // This should produce the string "CKJ", but you must not write the characters C, K, or J in the code of your solution. -let initials = ``; +// let initials = ``; +let initials = `${firstName.charAt(0)} ${middleName.charAt(0)} ${lastName.charAt(0)}`; -// https://www.google.com/search?q=get+first+character+of+string+mdn +console.log(initials); +// https://www.google.com/search?q=get+first+character+of+string+mdn From d58e2082ab8e770d90bfb4e971fa1afb7a05c57c Mon Sep 17 00:00:00 2001 From: Sayeed Hussain Date: Wed, 29 Jul 2026 16:04:11 +0100 Subject: [PATCH 25/27] fix error --- Sprint-2/1-key-errors/0.js | 15 ++------ Sprint-2/1-key-errors/1.js | 6 ++-- Sprint-2/1-key-errors/2 (1).js | 20 +++++++++++ Sprint-2/1-key-errors/2.js | 10 ++---- Sprint-2/2-mandatory-debug/0.js | 7 ---- Sprint-2/2-mandatory-debug/1.js | 8 ----- Sprint-2/2-mandatory-debug/2.js | 15 -------- Sprint-2/3-mandatory-implement/1-bmi.js | 10 ++---- Sprint-2/3-mandatory-implement/2-cases.js | 6 ---- .../3-mandatory-implement/3-to-pounds (1).js | 6 ++++ Sprint-2/3-mandatory-implement/3-to-pounds.js | 30 ---------------- Sprint-2/4-mandatory-interpret/time-format.js | 9 +---- Sprint-2/5-stretch-extend/format-time.js | 35 ++----------------- 13 files changed, 38 insertions(+), 139 deletions(-) create mode 100644 Sprint-2/1-key-errors/2 (1).js create mode 100644 Sprint-2/3-mandatory-implement/3-to-pounds (1).js delete mode 100644 Sprint-2/3-mandatory-implement/3-to-pounds.js diff --git a/Sprint-2/1-key-errors/0.js b/Sprint-2/1-key-errors/0.js index 287e3f3e9b..653d6f5a07 100644 --- a/Sprint-2/1-key-errors/0.js +++ b/Sprint-2/1-key-errors/0.js @@ -4,21 +4,10 @@ // call the function capitalise with a string input // interpret the error message and figure out why an error is occurring -//////// error code ///// - -// function capitalise(str) { -// let str = `${str[0].toUpperCase()}${str.slice(1)}`; -// return str; -// } - -// fix code // function capitalise(str) { - let string = `${str[0].toUpperCase()}${str.slice(1)}`; - return string; + let str = `${str[0].toUpperCase()}${str.slice(1)}`; + return str; } -console.log(capitalise("hello js error")); // =============> write your explanation here // =============> write your new code here - -// The Error was syntax error as "str" has already been declared and we can't declare it again as variable name. Now I declare a new variable name and assign value. diff --git a/Sprint-2/1-key-errors/1.js b/Sprint-2/1-key-errors/1.js index d5afc4cd60..f2d56151f4 100644 --- a/Sprint-2/1-key-errors/1.js +++ b/Sprint-2/1-key-errors/1.js @@ -3,18 +3,16 @@ // Why will an error occur when this program runs? // =============> write your prediction here -// There will be two errors, First syntax errors as decimalNumber has already been declared and tried to redeclare it again inside function. -// second without defining decimalNumber try to use decimalNumber in log. - // Try playing computer with the example to work out what is going on function convertToPercentage(decimalNumber) { + const decimalNumber = 0.5; const percentage = `${decimalNumber * 100}%`; return percentage; } -console.log(convertToPercentage(0.9)); +console.log(decimalNumber); // =============> write your explanation here diff --git a/Sprint-2/1-key-errors/2 (1).js b/Sprint-2/1-key-errors/2 (1).js new file mode 100644 index 0000000000..aad57f7cfe --- /dev/null +++ b/Sprint-2/1-key-errors/2 (1).js @@ -0,0 +1,20 @@ + +// Predict and explain first BEFORE you run any code... + +// this function should square any number but instead we're going to get an error + +// =============> write your prediction of the error here + +function square(3) { + return num * num; +} + +// =============> write the error message here + +// =============> explain this error message here + +// Finally, correct the code to fix the problem + +// =============> write your new code here + + diff --git a/Sprint-2/1-key-errors/2.js b/Sprint-2/1-key-errors/2.js index b79fb9bae2..aad57f7cfe 100644 --- a/Sprint-2/1-key-errors/2.js +++ b/Sprint-2/1-key-errors/2.js @@ -1,3 +1,4 @@ + // Predict and explain first BEFORE you run any code... // this function should square any number but instead we're going to get an error @@ -5,20 +6,15 @@ // =============> write your prediction of the error here function square(3) { - return num * num; + return num * num; } // =============> write the error message here -// SyntaxError: Unexpected number // =============> explain this error message here -// syntax error as function does not allow actual value as a parameter // Finally, correct the code to fix the problem // =============> write your new code here -function square(num) { - return num * num; -} -console.log(square(2)); + diff --git a/Sprint-2/2-mandatory-debug/0.js b/Sprint-2/2-mandatory-debug/0.js index af864ffb04..b27511b417 100644 --- a/Sprint-2/2-mandatory-debug/0.js +++ b/Sprint-2/2-mandatory-debug/0.js @@ -10,12 +10,5 @@ console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`); // =============> write your explanation here -// first log will show result by multiplying but second log will not show any result instead will show undefined because we did not say the code -// what to do and what should return. - // Finally, correct the code to fix the problem // =============> write your new code here - -function multiply(a, b) { - return a * b; -} diff --git a/Sprint-2/2-mandatory-debug/1.js b/Sprint-2/2-mandatory-debug/1.js index 358cbedd95..37cedfbcfd 100644 --- a/Sprint-2/2-mandatory-debug/1.js +++ b/Sprint-2/2-mandatory-debug/1.js @@ -1,8 +1,6 @@ // Predict and explain first... // =============> write your prediction here -// It will show undefined - function sum(a, b) { return; a + b; @@ -11,11 +9,5 @@ function sum(a, b) { console.log(`The sum of 10 and 32 is ${sum(10, 32)}`); // =============> write your explanation here -// the reason is that I did not write anything inside return that's why return can't find anything to return - // Finally, correct the code to fix the problem // =============> write your new code here - -function sum(a, b) { - return a + b; -} diff --git a/Sprint-2/2-mandatory-debug/2.js b/Sprint-2/2-mandatory-debug/2.js index 88602f1379..57d3f5dc35 100644 --- a/Sprint-2/2-mandatory-debug/2.js +++ b/Sprint-2/2-mandatory-debug/2.js @@ -2,7 +2,6 @@ // Predict the output of the following code: // =============> Write your prediction here -// I predicted that it will show undefined or fixed number like 3 const num = 103; @@ -16,24 +15,10 @@ console.log(`The last digit of 806 is ${getLastDigit(806)}`); // Now run the code and compare the output to your prediction // =============> write the output here -// The last digit of 42 is 3 -// The last digit of 105 is 3 -// The last digit of 806 is 3 // Explain why the output is the way it is -// num has fix number which is 3 and i return this fix number // =============> write your explanation here -// user want last digit whatever number they put but i set up a fix number which will return that one that's why now i removed fixed number and wrote a parameter in function -// which will contain user number whatever number they put and get the last digit. // Finally, correct the code to fix the problem // =============> write your new code here -function getLastDigit(num) { - return num.toString().slice(-1); -} - -console.log(`The last digit of 42 is ${getLastDigit(42)}`); -console.log(`The last digit of 105 is ${getLastDigit(105)}`); -console.log(`The last digit of 806 is ${getLastDigit(806)}`); - // This program should tell the user the last digit of each number. // Explain why getLastDigit is not working properly - correct the problem diff --git a/Sprint-2/3-mandatory-implement/1-bmi.js b/Sprint-2/3-mandatory-implement/1-bmi.js index 2075b159ea..17b1cbde1b 100644 --- a/Sprint-2/3-mandatory-implement/1-bmi.js +++ b/Sprint-2/3-mandatory-implement/1-bmi.js @@ -15,11 +15,5 @@ // It should return their Body Mass Index to 1 decimal place function calculateBMI(weight, height) { - let allHeight = Number(height * height); - let heightWeight = Number(weight / allHeight); - let oneDecimal = heightWeight.toFixed(1); - return oneDecimal; - - // return the BMI of someone based off their weight and height -} -console.log(calculateBMI(78, 1.77)); + // return the BMI of someone based off their weight and height +} \ No newline at end of file diff --git a/Sprint-2/3-mandatory-implement/2-cases.js b/Sprint-2/3-mandatory-implement/2-cases.js index 2f665fe52e..5b0ef77ad9 100644 --- a/Sprint-2/3-mandatory-implement/2-cases.js +++ b/Sprint-2/3-mandatory-implement/2-cases.js @@ -14,9 +14,3 @@ // You will need to come up with an appropriate name for the function // Use the MDN string documentation to help you find a solution // This might help https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase - -function UpperSnake(string) { - let upper = string.toUpperCase().split(" ").join("_"); - return upper; -} -console.log(UpperSnake("hello py")); diff --git a/Sprint-2/3-mandatory-implement/3-to-pounds (1).js b/Sprint-2/3-mandatory-implement/3-to-pounds (1).js new file mode 100644 index 0000000000..6265a1a703 --- /dev/null +++ b/Sprint-2/3-mandatory-implement/3-to-pounds (1).js @@ -0,0 +1,6 @@ +// In Sprint-1, there is a program written in interpret/to-pounds.js + +// You will need to take this code and turn it into a reusable block of code. +// You will need to declare a function called toPounds with an appropriately named parameter. + +// You should call this function a number of times to check it works for different inputs diff --git a/Sprint-2/3-mandatory-implement/3-to-pounds.js b/Sprint-2/3-mandatory-implement/3-to-pounds.js deleted file mode 100644 index 1d1527cda0..0000000000 --- a/Sprint-2/3-mandatory-implement/3-to-pounds.js +++ /dev/null @@ -1,30 +0,0 @@ -// In Sprint-1, there is a program written in interpret/to-pounds.js - -// You will need to take this code and turn it into a reusable block of code. -// You will need to declare a function called toPounds with an appropriately named parameter. - -// You should call this function a number of times to check it works for different inputs - -function toPounds(penceString) { - const penceStringWithoutTrailingP = penceString.substring( - 0, - penceString.length - 1 - ); - - const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0"); - const pounds = paddedPenceNumberString.substring( - 0, - paddedPenceNumberString.length - 2 - ); - - const pence = paddedPenceNumberString - .substring(paddedPenceNumberString.length - 2) - .padEnd(2, "0"); - - let poundPence = `£${pounds}.${pence}`; - - return poundPence; -} -console.log(toPounds("223p")); -console.log(toPounds("43p")); -console.log(toPounds("129p")); diff --git a/Sprint-2/4-mandatory-interpret/time-format.js b/Sprint-2/4-mandatory-interpret/time-format.js index 2d6a98d9a8..17127bc01e 100644 --- a/Sprint-2/4-mandatory-interpret/time-format.js +++ b/Sprint-2/4-mandatory-interpret/time-format.js @@ -15,8 +15,6 @@ function formatTimeDisplay(seconds) { return `${pad(totalHours)}:${pad(remainingMinutes)}:${pad(remainingSeconds)}`; } -console.log(formatTimeDisplay(61)); - // You will need to play computer with this example - use the Python Visualiser https://pythontutor.com/visualize.html#mode=edit // to help you answer these questions @@ -24,22 +22,17 @@ console.log(formatTimeDisplay(61)); // a) When formatTimeDisplay is called how many times will pad be called? // =============> write your answer here -// Answer : three times // Call formatTimeDisplay with an input of 61, now answer the following: // b) What is the value assigned to num when pad is called for the first time? // =============> write your answer here -// answer : 0 // c) What is the return value of pad is called for the first time? // =============> write your answer here -// Answer : 00 // d) What is the value assigned to num when pad is called for the last time in this program? Explain your answer // =============> write your answer here -// answer : 1 and when pad is called, it is called remainingSecond as argument. when formatDisplay runs(61) then 61 divided by 60 and remaining number is 1,which passed to num, so the value of num is 1. -// + // e) What is the return value of pad when it is called for the last time in this program? Explain your answer // =============> write your answer here -// answer: 01. return value is zero one because first received it one then pad formatted this number with two length. diff --git a/Sprint-2/5-stretch-extend/format-time.js b/Sprint-2/5-stretch-extend/format-time.js index 2bbdbf1384..32a32e66b8 100644 --- a/Sprint-2/5-stretch-extend/format-time.js +++ b/Sprint-2/5-stretch-extend/format-time.js @@ -4,16 +4,10 @@ function formatAs12HourClock(time) { const hours = Number(time.slice(0, 2)); - const mint = time.slice(-2); if (hours > 12) { return `${hours - 12}:00 pm`; - } else if (hours === 0) { - return `12:${mint} am`; - } else if (hours === 12) { - return `12:${mint} pm`; - } else { - return `${time} am`; } + return `${time} am`; } const currentOutput = formatAs12HourClock("08:00"); @@ -22,35 +16,10 @@ console.assert( currentOutput === targetOutput, `current output: ${currentOutput}, target output: ${targetOutput}` ); + const currentOutput2 = formatAs12HourClock("23:00"); const targetOutput2 = "11:00 pm"; console.assert( currentOutput2 === targetOutput2, `current output: ${currentOutput2}, target output: ${targetOutput2}` ); - -const currentOutput3 = formatAs12HourClock("00:00"); -const targetOutput3 = "12:00 am"; -console.assert( - currentOutput3 === targetOutput3, - `current output: ${currentOutput2}, target output: ${targetOutput2}` -); - -const currentOutput4 = formatAs12HourClock("16:00"); -const targetOutput4 = "04:00 pm"; -console.assert( - currentOutput4 === targetOutput4, - `current output: ${currentOutput2}, target output: ${targetOutput2}` -); - -const currentOutput5 = formatAs12HourClock("20:00"); -const targetOutput5 = "08:00 pm"; -console.assert( - currentOutput5 === targetOutput5, - `current output: ${currentOutput2}, target output: ${targetOutput2}` -); - -console.log(formatAs12HourClock("08:00")); -console.log(formatAs12HourClock("23:00")); -console.log(formatAs12HourClock("00:00")); -console.log(formatAs12HourClock("16:00")); From 9efb8a79c131a1900ed0da9682d0b5c8a54f2248 Mon Sep 17 00:00:00 2001 From: Sahid Hussain Date: Thu, 30 Jul 2026 09:51:37 +0100 Subject: [PATCH 26/27] fix revert files --- Sprint-2/1-key-errors/2 (1).js | 20 ------------------- .../{3-to-pounds (1).js => 3-to-pounds.js} | 0 2 files changed, 20 deletions(-) delete mode 100644 Sprint-2/1-key-errors/2 (1).js rename Sprint-2/3-mandatory-implement/{3-to-pounds (1).js => 3-to-pounds.js} (100%) diff --git a/Sprint-2/1-key-errors/2 (1).js b/Sprint-2/1-key-errors/2 (1).js deleted file mode 100644 index aad57f7cfe..0000000000 --- a/Sprint-2/1-key-errors/2 (1).js +++ /dev/null @@ -1,20 +0,0 @@ - -// Predict and explain first BEFORE you run any code... - -// this function should square any number but instead we're going to get an error - -// =============> write your prediction of the error here - -function square(3) { - return num * num; -} - -// =============> write the error message here - -// =============> explain this error message here - -// Finally, correct the code to fix the problem - -// =============> write your new code here - - diff --git a/Sprint-2/3-mandatory-implement/3-to-pounds (1).js b/Sprint-2/3-mandatory-implement/3-to-pounds.js similarity index 100% rename from Sprint-2/3-mandatory-implement/3-to-pounds (1).js rename to Sprint-2/3-mandatory-implement/3-to-pounds.js From 0b2dbe20d6147f497febc5875e845a48b8584663 Mon Sep 17 00:00:00 2001 From: Sayeed Hussain Date: Thu, 30 Jul 2026 10:07:18 +0100 Subject: [PATCH 27/27] fix revert sprint-1 task --- Sprint-1/1-key-exercises/2-initials.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Sprint-1/1-key-exercises/2-initials.js b/Sprint-1/1-key-exercises/2-initials.js index 3c0d5d3a7c..47561f6175 100644 --- a/Sprint-1/1-key-exercises/2-initials.js +++ b/Sprint-1/1-key-exercises/2-initials.js @@ -5,9 +5,7 @@ let lastName = "Johnson"; // Declare a variable called initials that stores the first character of each string. // This should produce the string "CKJ", but you must not write the characters C, K, or J in the code of your solution. -// let initials = ``; -let initials = `${firstName.charAt(0)} ${middleName.charAt(0)} ${lastName.charAt(0)}`; - -console.log(initials); +let initials = ``; // https://www.google.com/search?q=get+first+character+of+string+mdn +