London | ITP-May-2025 | Seddiq Azam | Module-Structuring-and-Testing-Data | Sprint-2 #534
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request focuses on debugging and improving JavaScript functions in various files under the
Sprint-2
directory. The changes address syntax errors, logical errors, and implementation of new functionality. Below is a summary of the most important changes grouped by theme:Debugging and Fixing Syntax/Logical Errors:
capitalise
function: Removedlet
from the function to allow modification of the existingstr
variable.convertToPercentage
function: Resolved variable scope issues by definingdecimalNumber
outside the function and passing it as an argument.square
function: Changed the invalid parameter3
tonum
and ensured proper function calls.multiply
function: Added areturn
statement to allow the function to return the multiplication result instead of logging it.sum
function: Eliminated a semicolon that was preventing the function from executing properly.Debugging Issues with Global Variables:
getLastDigit
function: Updated the function to accept a parameter instead of relying on a fixed global variable, ensuring correct outputs for different inputs.Implementing New Functionality:
calculateBMI
function: Added a function to calculate BMI with weight and height, formatted to one decimal place.toUpperSnakeCase
function: Created a function to convert strings to uppercase and replace spaces with underscores.toPounds
function: Added a function to convert a pence string (e.g., "399p") into a formatted pounds string (e.g., "£3.99").Interpretation and Explanation of Existing Code:
formatTimeDisplay
function: Provided detailed answers on how thepad
function is called and its behavior during time formatting.These changes collectively improve the codebase by fixing errors, enhancing functionality, and ensuring clarity in explanations and implementations.<!--
You must title your PR like this:
REGION | COHORT_NAME | FIRST_NAME LAST_NAME | PROJ_NAME
For example,
London | May-2025 | Carol Owen | Sprint-1
Complete the task list below this message.
If your PR is rejected, check the task list.
-->
Learners, PR Template
Self checklist
Changelist
Briefly explain your PR.
In this PR, you will see the necessary changes made and questions answered for Sprint 2.
This request also includes multiple improvements and the implementation of various functions related to JavaScript fundamentals.
Questions
Ask any questions you have for your reviewer.