Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
a318e04
called a function , interpreted the error message
alexandru-pocovnicu Oct 3, 2025
686be02
fixed the code to log the function and not the parameter
alexandru-pocovnicu Oct 3, 2025
763574c
fixed the function to return the square of a number by replacing the …
alexandru-pocovnicu Oct 3, 2025
f7173fc
replaced console.log with return inside the function
alexandru-pocovnicu Oct 3, 2025
9bfd01a
removed the semicolon after the "return" and moved "a+b" on the same …
alexandru-pocovnicu Oct 3, 2025
58fda13
removed unused code and updated the parameter
alexandru-pocovnicu Oct 3, 2025
0b055f8
implemented a function that calculates bmi with one decimal
alexandru-pocovnicu Oct 3, 2025
b9c50c9
implemented a function that turns a string in to snake uppercase
alexandru-pocovnicu Oct 3, 2025
e02e2e7
updated the function to replace all the spaces between words with"_"
alexandru-pocovnicu Oct 3, 2025
e9b8d94
created a function that converts pence in to pounds
alexandru-pocovnicu Oct 3, 2025
57ad058
added comments to answer the questions
alexandru-pocovnicu Oct 3, 2025
c688a68
wrote test cases for edge cases and updated the function accordingly
alexandru-pocovnicu Oct 3, 2025
6aa1613
fix: add space for readability in time formatting condition
alexandru-pocovnicu Oct 3, 2025
ad3dfa9
style: format code for consistency and readability
alexandru-pocovnicu Oct 20, 2025
b2a5048
refactor: simplify BMI calculation by removing unnecessary string con…
alexandru-pocovnicu Oct 20, 2025
b2684a1
fix: correct time formatting logic for midnight and noon cases
alexandru-pocovnicu Oct 20, 2025
dab924b
fix: update password validation logic
alexandru-pocovnicu Oct 23, 2025
9c73a1c
fix: ensure BMI result is returned as a number
alexandru-pocovnicu Oct 24, 2025
03018e6
fix: correct comparison operators and format output for consistency i…
alexandru-pocovnicu Oct 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 5 additions & 11 deletions Sprint-2/3-mandatory-implement/1-bmi.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,9 @@
// It should return their Body Mass Index to 1 decimal place

function calculateBMI(weight, height) {
let sqh=height*height;
let bmi=weight/sqh;
let bmiS=bmi.toString()


if(bmiS.includes(".")){
let dotBmiS=bmiS.indexOf(".")
return (Number(bmiS.slice(0,dotBmiS+2)))
} return bmi

let sqh = height * height;
let bmi = weight / sqh;

return bmi.toFixed(1);
Copy link
Contributor

Choose a reason for hiding this comment

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

What type of value do you expect the function to return? A number or a string?
Does your function return the type of value you expect?

Choose a reason for hiding this comment

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

it returns a number , but the requrements don't specify should return

Copy link
Contributor

Choose a reason for hiding this comment

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

Is the value of bmi.toFixed(1) a number or a string? They may "look" the same when we use console.log() to output them on the screen, but internally they are represented differently.

The spec does not specify what type of value the function should return, but what is your expectation? I am just concern if your code matches your expectation or not.

Choose a reason for hiding this comment

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

you are right , i was expecting the function to return a number, didn't realise .toFixed() turned it in to a string

}
console.log(calculateBMI(20,1.79));
console.log(calculateBMI(20, 1.79));
10 changes: 5 additions & 5 deletions Sprint-2/5-stretch-extend/format-time.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
function formatAs12HourClock(time) {
const hours = Number(time.slice(0, 2));
const minutes=time.slice(3,5)
if(hours<1){
if(hours===0){
return `12:${minutes} am`
}
if(hours==12 && minutes==00){
return "12:00 pm"
if(hours===12 ){
return `${hours}:${minutes} pm`
}
if (hours > 12) {
return `${hours - 12}:${minutes} pm`;
Expand Down Expand Up @@ -52,8 +52,8 @@ console.assert(
`current output: ${currentOutput5}, target output: ${targetOutput5}`
);

const currentOutput6 = formatAs12HourClock("12:00");
const targetOutput6 = "12:00 pm";
const currentOutput6 = formatAs12HourClock("12:59");
const targetOutput6 = "12:59 pm";
console.assert(
currentOutput6 === targetOutput6,
`current output: ${currentOutput6}, target output: ${targetOutput6}`
Expand Down