-
-
Notifications
You must be signed in to change notification settings - Fork 262
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
| 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
hourswon'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");
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.
-
12:59 pm
-
1:33 am
-
1:33 pm
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.
Did your function return the values you expect from these function calls?
formatAs12HourClock("01:33");`
formatAs12HourClock("13:33");
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.
i got 01:33 am
and 1:33 pm
I think that's right
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.
"01:33 am" is not quite the same as "1:33 am".
|
thank you |
| let sqh = height * height; | ||
| let bmi = weight / sqh; | ||
|
|
||
| return bmi.toFixed(1); |
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.
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?
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.
it returns a number , but the requrements don't specify should return
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.
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.
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.
you are right , i was expecting the function to return a number, didn't realise .toFixed() turned it in to a string
| 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.
Did your function return the values you expect from these function calls?
formatAs12HourClock("01:33");`
formatAs12HourClock("13:33");
| const minutes=time.slice(3,5) | ||
| if(hours===0){ | ||
| if(hours==0){ | ||
| return `12:${minutes} am` | ||
| } | ||
| if(hours===12 ){ |
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.
Why change the === if one of the if statements, but not the other?
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.
i shouldn't have changed it in the first place
|
Well done. |
Learners, PR Template
Self checklist
Changelist
In this pill request I have fixed errors, interpreted and implemented code
Questions