From 4cb935407450362d5a31774258cdda03bac06917 Mon Sep 17 00:00:00 2001 From: Declan Williams Date: Mon, 9 Jun 2025 16:42:59 +0100 Subject: [PATCH 01/17] fix: resolve variable redeclaration error in capitalize function --- Sprint-2/1-key-errors/0.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Sprint-2/1-key-errors/0.js b/Sprint-2/1-key-errors/0.js index 653d6f5a0..28eba944b 100644 --- a/Sprint-2/1-key-errors/0.js +++ b/Sprint-2/1-key-errors/0.js @@ -1,13 +1,25 @@ // Predict and explain first... // =============> write your prediction here +// I expect the code to possibly throw an error because str is being declared twice. once in the function and again in the function body declared as "let" +// This function looks like its trying to turn the first letter of a string into a capital letter. // call the function capitalise with a string input // interpret the error message and figure out why an error is occurring +// after trying to run the code it produced a "SyntaxError: Identifier 'str' has already been declared" function capitalise(str) { let str = `${str[0].toUpperCase()}${str.slice(1)}`; return str; } - +console.log(capitalise("hello")); // =============> write your explanation here +// this is because the variable str is declared twice, once in the function parameters and again inside the function body with "let str" +// str is declared as a parameter, so we don't need to declare it again with let you can just use it directly. +// to fix the error, we can remove the "let" keyword from the second declaration of str. // =============> write your new code here + +function capitalize(str) { + str = `${str[0].toUpperCase()}${str.slice(1)}`; + return str; +} +console.log(capitalize("the first letter should be capitalized")); \ No newline at end of file From 2fafe6e28f566b9684774b36635d72c23d35c21b Mon Sep 17 00:00:00 2001 From: Declan Williams Date: Mon, 9 Jun 2025 16:44:15 +0100 Subject: [PATCH 02/17] fix: comment out erroneous capitalize function to prevent redeclaration error so that new code will work correctly and not throw the old error --- Sprint-2/1-key-errors/0.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sprint-2/1-key-errors/0.js b/Sprint-2/1-key-errors/0.js index 28eba944b..687539da2 100644 --- a/Sprint-2/1-key-errors/0.js +++ b/Sprint-2/1-key-errors/0.js @@ -7,11 +7,11 @@ // interpret the error message and figure out why an error is occurring // after trying to run the code it produced a "SyntaxError: Identifier 'str' has already been declared" -function capitalise(str) { +/* function capitalise(str) { let str = `${str[0].toUpperCase()}${str.slice(1)}`; return str; } -console.log(capitalise("hello")); +console.log(capitalise("hello")); */ // =============> write your explanation here // this is because the variable str is declared twice, once in the function parameters and again inside the function body with "let str" // str is declared as a parameter, so we don't need to declare it again with let you can just use it directly. From 7620265b028ed368bf98a544d47d36a742c0de02 Mon Sep 17 00:00:00 2001 From: Declan Williams Date: Fri, 13 Jun 2025 14:11:11 +0100 Subject: [PATCH 03/17] fix: correct parameter name in square function to prevent syntax error and update console log example --- Sprint-2/1-key-errors/2.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Sprint-2/1-key-errors/2.js b/Sprint-2/1-key-errors/2.js index aad57f7cf..8f1ecb6ee 100644 --- a/Sprint-2/1-key-errors/2.js +++ b/Sprint-2/1-key-errors/2.js @@ -4,17 +4,29 @@ // this function should square any number but instead we're going to get an error // =============> write your prediction of the error here +// The function is defined incorrectly using a number as a parameter name so it will throw an error when called because looking for an identifier but finds a number instead. -function square(3) { +/* function square(3) { return num * num; } +*/ // =============> write the error message here +/* function square(3) { + ^ +SyntaxError: Unexpected number +*/ // =============> explain this error message here +// SyntaxError: This means there is something wrong with the way the code is written, so JavaScript cannot understand it. +// unexpected number: This means that the code is trying to use a number where it expects an identifier (like a variable name). In this case, the function parameter is incorrectly named as a number (3) instead of a valid identifier. // Finally, correct the code to fix the problem +// to fix the problem, we need to change the parameter name to a valid identifier, like "num" or "number". // =============> write your new code here - +function square(num){ + return num * num; +} +console.log(square(10)); \ No newline at end of file From 071cf2125be6448d9aaa6ffbf7306412b13fd169 Mon Sep 17 00:00:00 2001 From: Declan Williams Date: Fri, 13 Jun 2025 14:13:41 +0100 Subject: [PATCH 04/17] fix: add console log for square function with example input and corrected error missing ) --- Sprint-2/1-key-errors/2.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Sprint-2/1-key-errors/2.js b/Sprint-2/1-key-errors/2.js index 8f1ecb6ee..f7f09de99 100644 --- a/Sprint-2/1-key-errors/2.js +++ b/Sprint-2/1-key-errors/2.js @@ -29,4 +29,5 @@ SyntaxError: Unexpected number function square(num){ return num * num; } +console.log(square(3)); console.log(square(10)); \ No newline at end of file From c1c09a6c9b33da310c852bfb777030d53033ba44 Mon Sep 17 00:00:00 2001 From: Declan Williams Date: Fri, 13 Jun 2025 18:05:06 +0100 Subject: [PATCH 05/17] update comments to clarify expected output and explanation in getLastDigit function --- Sprint-2/2-mandatory-debug/2.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Sprint-2/2-mandatory-debug/2.js b/Sprint-2/2-mandatory-debug/2.js index 57d3f5dc3..9b432f18c 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 expect each of the calls to return the last digit of "num" which is "3" its defined as a constant and we are using that const in the return statement. const num = 103; @@ -15,8 +16,15 @@ 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 +// Output: +// 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 // =============> write your explanation here +// The output is the same for all three calls because the function getLastDigit does not take any parameters. It always uses the constant "num" which is defined as 103, and will always returns the last digit of 103, which is "3". + // Finally, correct the code to fix the problem // =============> write your new code here From e72b13adbb0eb656c3d01950ed3c9548de9f77af Mon Sep 17 00:00:00 2001 From: Declan Williams Date: Fri, 13 Jun 2025 22:22:29 +0100 Subject: [PATCH 06/17] fix: correct getLastDigit function to accept parameters and return the last digit of input numbers --- Sprint-2/2-mandatory-debug/2.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Sprint-2/2-mandatory-debug/2.js b/Sprint-2/2-mandatory-debug/2.js index 9b432f18c..7356e322d 100644 --- a/Sprint-2/2-mandatory-debug/2.js +++ b/Sprint-2/2-mandatory-debug/2.js @@ -3,7 +3,7 @@ // Predict the output of the following code: // =============> Write your prediction here // I expect each of the calls to return the last digit of "num" which is "3" its defined as a constant and we are using that const in the return statement. - +/* const num = 103; function getLastDigit() { @@ -13,7 +13,7 @@ function getLastDigit() { 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)}`); - +*/ // Now run the code and compare the output to your prediction // =============> write the output here // Output: @@ -27,6 +27,13 @@ console.log(`The last digit of 806 is ${getLastDigit(806)}`); // 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 832d9bbbac94b97fc2e559dffbda7698d6363501 Mon Sep 17 00:00:00 2001 From: Declan Williams Date: Fri, 13 Jun 2025 22:36:18 +0100 Subject: [PATCH 07/17] fix: update explanation for getLastDigit function to clarify parameter usage --- Sprint-2/2-mandatory-debug/2.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Sprint-2/2-mandatory-debug/2.js b/Sprint-2/2-mandatory-debug/2.js index 7356e322d..d4fa668fd 100644 --- a/Sprint-2/2-mandatory-debug/2.js +++ b/Sprint-2/2-mandatory-debug/2.js @@ -37,3 +37,4 @@ 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 +// we corrected the problem by adding a parameter to the function getLastDigit, so it now takes a number as an argument and returns the last digit of that number. From 2a18e2c5fe95e219c342913a8d1bbc8555a30246 Mon Sep 17 00:00:00 2001 From: Declan W Date: Sat, 14 Jun 2025 16:00:05 +0100 Subject: [PATCH 08/17] explained in comments why errors occured and then refactored the code to fix the convert to percentage function works correctly --- Sprint-2/1-key-errors/1.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Sprint-2/1-key-errors/1.js b/Sprint-2/1-key-errors/1.js index f2d56151f..fea41cd03 100644 --- a/Sprint-2/1-key-errors/1.js +++ b/Sprint-2/1-key-errors/1.js @@ -2,9 +2,12 @@ // Why will an error occur when this program runs? // =============> write your prediction here +// I expect a Syntax error to be thrown due to the const "decimalNumber" has already been declaired in the parameters of the function. +// I also expect an error from the "console.log(decimalnumber)" as its calling "decimalNumber" from outside the function // Try playing computer with the example to work out what is going on +/* function convertToPercentage(decimalNumber) { const decimalNumber = 0.5; const percentage = `${decimalNumber * 100}%`; @@ -12,9 +15,19 @@ function convertToPercentage(decimalNumber) { return percentage; } -console.log(decimalNumber); +console.log(decimalNumber); +*/ // =============> write your explanation here +// When running the code i get thrown a Syntax error: "identifer 'decimalNumber' has already been declared". To solve this you must remove the "const decimalNumber = 0.5" from the function as its already been defined in the parameters of the function. +// after testing the code and fixing the syntax error we then recived another error: "ReferenceError: decimalNumber is not defined" To solve this you must change the "console.log(decimalNumber)" to "console.log(convertToPercentage())". // Finally, correct the code to fix the problem // =============> write your new code here + +function convertToPercentage(decimalNumber) { + const percentage = `${decimalNumber * 100}%`; + return percentage; +} + +console.log(convertToPercentage(0.5)); // equals to 50% From dde59174ff3c56a658c5ea61bfeb4ec590929fa0 Mon Sep 17 00:00:00 2001 From: Declan Williams Date: Sun, 15 Jun 2025 14:28:54 +0100 Subject: [PATCH 09/17] fix: update multiply function to return the product instead of logging it and updated comments --- Sprint-2/2-mandatory-debug/0.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Sprint-2/2-mandatory-debug/0.js b/Sprint-2/2-mandatory-debug/0.js index b27511b41..def4d3027 100644 --- a/Sprint-2/2-mandatory-debug/0.js +++ b/Sprint-2/2-mandatory-debug/0.js @@ -1,14 +1,24 @@ // Predict and explain first... +// I expect the code to log the results of multiplying 10 and 32 but in line 10 i expect it to return undefined because the function "multiply" does not have a return statement. // =============> write your prediction here - +/* function multiply(a, b) { console.log(a * b); } console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`); - +*/ // =============> write your explanation here +// The code defines a function "multiply" that takes two parameters "a" and "b" and logs their product to the console. However, it does not return any value from the function. +// The function `multiply` is called with arguments 10 and 32, but since it does not return a value, the template literal will log "undefined" for the result of the multiplication. +// and to fix this, the function should return the product instead of just logging it. + // Finally, correct the code to fix the problem // =============> write your new code here + +function multiply(a, b){ + return a * b; // Return the product instead of logging it +} +console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`); // now this will log the correct results \ No newline at end of file From fdf492e07fac6e0559d9e41ea975c6e51ec83e64 Mon Sep 17 00:00:00 2001 From: Declan Williams Date: Sun, 15 Jun 2025 15:38:09 +0100 Subject: [PATCH 10/17] fix: correct sum function to return the sum of two numbers and update comments for clarity --- 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 37cedfbcf..0c1af789f 100644 --- a/Sprint-2/2-mandatory-debug/1.js +++ b/Sprint-2/2-mandatory-debug/1.js @@ -1,5 +1,6 @@ // Predict and explain first... // =============> write your prediction here +// I expect the code to log the sum of 10 and 32, but it will return undefined because the function "sum" does not have a return statement for the sum operation as line 7 has unreachable code due to the return statement on line 6 is returning nothing. function sum(a, b) { return; @@ -9,5 +10,12 @@ function sum(a, b) { console.log(`The sum of 10 and 32 is ${sum(10, 32)}`); // =============> write your explanation here +// The code defines a function "sum" that is intended to return the sum of two numbers "a" and "b". However, the return statement is placed before the addition operation, which means that the function will return `undefined` immediately without performing the addition. As a result, when we log the output, it will show "The sum of 10 and 32 is undefined". // Finally, correct the code to fix the problem // =============> write your new code here +// To fix this we need to moving the unreachable code after the return statement into the return statement itself, so that the function returns the sum of "a" and "b". + +function sum(a, b){ + return a + b; +} +console.log(`The sum of 10 and 32 is ${sum(10, 32)}`); // This will now correctly log "The sum of 10 and 32 is 42". \ No newline at end of file From 48d2e3aefbfe9a800fbe8fd73ca698c345173dc7 Mon Sep 17 00:00:00 2001 From: Declan Williams Date: Sun, 15 Jun 2025 17:18:21 +0100 Subject: [PATCH 11/17] feat: implement BMI calculation function and add example usage --- Sprint-2/3-mandatory-implement/1-bmi.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Sprint-2/3-mandatory-implement/1-bmi.js b/Sprint-2/3-mandatory-implement/1-bmi.js index 17b1cbde1..4bc8e8b5a 100644 --- a/Sprint-2/3-mandatory-implement/1-bmi.js +++ b/Sprint-2/3-mandatory-implement/1-bmi.js @@ -16,4 +16,10 @@ function calculateBMI(weight, height) { // return the BMI of someone based off their weight and height -} \ No newline at end of file + const heightSquared = height * height; // square the height + const bmi = weight / heightSquared; // calculate BMI by dividing weight by height squared + const roundedBmi = bmi.toFixed(1); // round the result to 1 decimal place + return roundedBmi; // return the rounded BMI value +} +console.log(calculateBMI(70, 1.73)); // Example usage: should return 23.4 +console.log(calculateBMI(80, 1.8)); // Example usage: should return 24.7 \ No newline at end of file From e2c65bfdf92ad10b184f44cc3e41dfc8ea103511 Mon Sep 17 00:00:00 2001 From: Declan Williams Date: Mon, 16 Jun 2025 05:52:30 +0100 Subject: [PATCH 12/17] feat: implement toUpperSnakeCase function to convert strings to UPPER_SNAKE_CASE --- Sprint-2/3-mandatory-implement/2-cases.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Sprint-2/3-mandatory-implement/2-cases.js b/Sprint-2/3-mandatory-implement/2-cases.js index 5b0ef77ad..352deb4b4 100644 --- a/Sprint-2/3-mandatory-implement/2-cases.js +++ b/Sprint-2/3-mandatory-implement/2-cases.js @@ -14,3 +14,11 @@ // 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 toUpperSnakeCase(input){ +const lowerCaseString = input.toUpperCase(); // converts the string input into uppercase(Capital letters) +const snakeCaseString = lowerCaseString.replace(/ /g, "_") // replaces the spaces with underscores +return snakeCaseString; // returns the string in UPPER_SNAKE_CASE +} +console.log(toUpperSnakeCase("hello there")); +console.log(toUpperSnakeCase("lord of the rings")); \ No newline at end of file From bb731c12a3d1a26416e8358bac4a00b747622236 Mon Sep 17 00:00:00 2001 From: Declan Williams Date: Tue, 17 Jun 2025 14:53:07 +0100 Subject: [PATCH 13/17] feat: implement toPounds function to convert pence strings to pounds format with example usage --- Sprint-2/3-mandatory-implement/3-to-pounds.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Sprint-2/3-mandatory-implement/3-to-pounds.js b/Sprint-2/3-mandatory-implement/3-to-pounds.js index 6265a1a70..44541e2d8 100644 --- a/Sprint-2/3-mandatory-implement/3-to-pounds.js +++ b/Sprint-2/3-mandatory-implement/3-to-pounds.js @@ -4,3 +4,16 @@ // 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"); + return `£${pounds}.${pence}p`; +} + +console.log(toPounds("399p")); +console.log(toPounds("100p")); +console.log(toPounds("7688p")); +console.log(toPounds("1p")); \ No newline at end of file From 8c166ffcb4c555913521bd2e1dd9fd8f63855b60 Mon Sep 17 00:00:00 2001 From: Declan Williams Date: Tue, 17 Jun 2025 18:47:53 +0100 Subject: [PATCH 14/17] fix: add console log and comments for clarity in formatTimeDisplay function --- Sprint-2/4-mandatory-interpret/time-format.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Sprint-2/4-mandatory-interpret/time-format.js b/Sprint-2/4-mandatory-interpret/time-format.js index 7c98eb0e8..531f0d2ed 100644 --- a/Sprint-2/4-mandatory-interpret/time-format.js +++ b/Sprint-2/4-mandatory-interpret/time-format.js @@ -10,6 +10,7 @@ function formatTimeDisplay(seconds) { return `${pad(totalHours)}:${pad(remainingMinutes)}:${pad(remainingSeconds)}`; } +console.log(formatTimeDisplay(61)); // Expected output: "00:01:01" // 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 @@ -18,17 +19,23 @@ function formatTimeDisplay(seconds) { // a) When formatTimeDisplay is called how many times will pad be called? // =============> write your answer here +//Answer: it is called 3 times once for each of the three calls to pad in the formatTimeDisplay function in line 11 return statement. // 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: The first call to pad is for totalHours which is 0. because 61 seconds is less than 3600 seconds (1 hour) the totalHours will be 0. // c) What is the return value of pad is called for the first time? // =============> write your answer here +// Answer: The first call to pad will return "00" because it converts the number 0 to a string and pads it with leading zeros to ensure it is at least 2 characters long. // 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: The last call to pad is for remainingSeconds which is 1. The value assigned to num will be 1 because it is the remaining seconds after calculating total hours and total minutes. // e) What is the return value assigned to num when pad is called for the last time in this program? Explain your answer // =============> write your answer here +// Answer: The last call to pad will return "01" because it converts the number 1 to a string and pads it with leading zeros to ensure it is at least 2 characters long. + From 2f41d575914ce0166a3ebed6221d711d049fae0f Mon Sep 17 00:00:00 2001 From: Declan W Date: Sat, 28 Jun 2025 15:35:22 +0100 Subject: [PATCH 15/17] Update 1-bmi.js updated comments for clarity on roundedBmi returning as a string. --- Sprint-2/3-mandatory-implement/1-bmi.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Sprint-2/3-mandatory-implement/1-bmi.js b/Sprint-2/3-mandatory-implement/1-bmi.js index 4bc8e8b5a..1727d59db 100644 --- a/Sprint-2/3-mandatory-implement/1-bmi.js +++ b/Sprint-2/3-mandatory-implement/1-bmi.js @@ -18,8 +18,8 @@ function calculateBMI(weight, height) { // return the BMI of someone based off their weight and height const heightSquared = height * height; // square the height const bmi = weight / heightSquared; // calculate BMI by dividing weight by height squared - const roundedBmi = bmi.toFixed(1); // round the result to 1 decimal place - return roundedBmi; // return the rounded BMI value + const roundedBmi = bmi.toFixed(1); // round the result to 1 decimal place and return as a string. + return roundedBmi; // return the string result of rounded BMI value } console.log(calculateBMI(70, 1.73)); // Example usage: should return 23.4 -console.log(calculateBMI(80, 1.8)); // Example usage: should return 24.7 \ No newline at end of file +console.log(calculateBMI(80, 1.8)); // Example usage: should return 24.7 From d04b7bd1e30315c3f9bf626636b265e85056e574 Mon Sep 17 00:00:00 2001 From: Declan W Date: Sat, 28 Jun 2025 15:47:30 +0100 Subject: [PATCH 16/17] Update 2-cases.js refactored code to be indented properly. and updated name of function to align more correctly with the values of the variable stored. --- Sprint-2/3-mandatory-implement/2-cases.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Sprint-2/3-mandatory-implement/2-cases.js b/Sprint-2/3-mandatory-implement/2-cases.js index 352deb4b4..3088c95bf 100644 --- a/Sprint-2/3-mandatory-implement/2-cases.js +++ b/Sprint-2/3-mandatory-implement/2-cases.js @@ -16,9 +16,9 @@ // This might help https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase function toUpperSnakeCase(input){ -const lowerCaseString = input.toUpperCase(); // converts the string input into uppercase(Capital letters) -const snakeCaseString = lowerCaseString.replace(/ /g, "_") // replaces the spaces with underscores -return snakeCaseString; // returns the string in UPPER_SNAKE_CASE + const upperCaseString = input.toUpperCase(); // converts the string input into uppercase(Capital letters) + const upperSnakeCase = lowerCaseString.replace(/ /g, "_") // replaces the spaces with underscores + return upperSnakeCase; // returns the string in UPPER_SNAKE_CASE } console.log(toUpperSnakeCase("hello there")); -console.log(toUpperSnakeCase("lord of the rings")); \ No newline at end of file +console.log(toUpperSnakeCase("lord of the rings")); From 7bdeaff0f98b06fbb28d3d104768d93f9a4988ab Mon Sep 17 00:00:00 2001 From: Declan W Date: Sat, 15 Nov 2025 10:28:08 +0000 Subject: [PATCH 17/17] fixed indentation --- Sprint-2/3-mandatory-implement/3-to-pounds.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-2/3-mandatory-implement/3-to-pounds.js b/Sprint-2/3-mandatory-implement/3-to-pounds.js index 44541e2d8..261573c9d 100644 --- a/Sprint-2/3-mandatory-implement/3-to-pounds.js +++ b/Sprint-2/3-mandatory-implement/3-to-pounds.js @@ -10,7 +10,7 @@ function toPounds(penceString){ const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0"); const pounds = paddedPenceNumberString.substring(0, paddedPenceNumberString.length - 2); const pence = paddedPenceNumberString.substring(paddedPenceNumberString.length - 2).padEnd(2, "0"); - return `£${pounds}.${pence}p`; + return `£${pounds}.${pence}p`; } console.log(toPounds("399p"));