-
-
Notifications
You must be signed in to change notification settings - Fork 221
London | 25-ITP-May | Alexandru Pocovnicu | Sprint 2 | Acoursework #728
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
base: main
Are you sure you want to change the base?
London | 25-ITP-May | Alexandru Pocovnicu | Sprint 2 | Acoursework #728
Conversation
…line with"return" otherwise a semicolon would be automatically inserted
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 | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Indentation is a bit off. Can you improve the indentation? You can try using the "Format Document" feature in
VSCode to help you indent the code. - Why terminated only some of the statements with a semicolon?
- Why use truncation instead of rounding to approximate the result to 1 decimal place?
Note: There are simpler ways (which involve using some built-in functions) to truncate/round a number to 1 decimal place.
if(hours<1){ | ||
return `12:${minutes} am` | ||
} | ||
if(hours==12 && minutes==00){ | ||
return "12:00 pm" | ||
} | ||
if (hours > 12) { | ||
return `${hours - 12}:00 pm`; | ||
return `${hours - 12}:${minutes} pm`; | ||
} | ||
return `${time} am`; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
Because
hours
won't be negative,if (hours == 0)
would probably be more readable thanif (hours < 1)
. -
What is the 12-hour clock equivalent of 24-hour clock time "12:59"?
-
What do you expect from the following function calls? Are the return values formatted consistently?
formatAs12HourClock("01:33");
formatAs12HourClock("13:33");
Learners, PR Template
Self checklist
Changelist
In this pill request I have fixed errors, interpreted and implemented code
Questions