Skip to content

London | ITP-May-2025 | Seddiq Azam | Module-Structuring-and-Testing-Data | Sprint-2 #534

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

sedazam
Copy link

@sedazam sedazam commented Jun 12, 2025

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:

  • Fixed redeclaration issues in capitalise function: Removed let from the function to allow modification of the existing str variable.
  • Corrected convertToPercentage function: Resolved variable scope issues by defining decimalNumber outside the function and passing it as an argument.
  • Fixed parameter and return issues in square function: Changed the invalid parameter 3 to num and ensured proper function calls.
  • Fixed missing return statement in multiply function: Added a return statement to allow the function to return the multiplication result instead of logging it.
  • Removed unnecessary semicolon in sum function: Eliminated a semicolon that was preventing the function from executing properly.

Debugging Issues with Global Variables:

  • Revised 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:

  • Implemented calculateBMI function: Added a function to calculate BMI with weight and height, formatted to one decimal place.
  • Added toUpperSnakeCase function: Created a function to convert strings to uppercase and replace spaces with underscores.
  • Implemented 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:

  • Analyzed formatTimeDisplay function: Provided detailed answers on how the pad 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

  • I have committed my files one by one, on purpose, and for a reason
  • I have titled my PR with REGION | COHORT_NAME | FIRST_NAME LAST_NAME | PROJ_NAME
  • I have tested my changes
  • My changes follow the style guide
  • My changes meet the requirements of this task

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.

@sedazam sedazam added 📅 Sprint 2 Assigned during Sprint 2 of this module Needs Review Participant to add when requesting review labels Jun 12, 2025
Copy link
Contributor

@cjyuan cjyuan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good. No chance required.

@cjyuan cjyuan added Complete Volunteer to add when work is complete and review comments have been addressed and removed Needs Review Participant to add when requesting review labels Jun 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Complete Volunteer to add when work is complete and review comments have been addressed 📅 Sprint 2 Assigned during Sprint 2 of this module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants