-
-
Notifications
You must be signed in to change notification settings - Fork 238
NW | 25-ITP-Sep | Ahmad Hmedan | Sprint 2 | Sprint 2 Coursework #783
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?
Conversation
// =============> write your new code here | ||
// =============> As I predict it will throw a SyntaxError: Identifier 'str' has already been declared | ||
//because in JavaScript we can not redeclare the same variable in the same scope. | ||
function Capitalise(str){ |
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.
In Javascript, we follow the convention of camelCase
for functions and variables
function calculateBMI(weight, height) { | ||
// return the BMI of someone based off their weight and height | ||
} | ||
let BMI=weight/(height*height); |
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.
Does this need to be let
here?
function ConvertToUpperSnakeCase(s1) | ||
{ | ||
let result = ""; | ||
for(let i=0;i<s1.length;i++) |
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 there a standard library function we could use here?
else | ||
result+=s1[i]; | ||
} | ||
let UPPER_SNAKE_CASE=result.toUpperCase(); |
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.
We typically follow the convention of camelCase
for Javascript variables
// You should call this function a number of times to check it works for different inputs | ||
|
||
|
||
function toPound(penceString) |
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.
This is functionally looking good 🙂
I would suggest using VS Code's format document feature - this will ensure your Javascript code is following a standard format. This makes it easier for yourself, and others, to read the code in the future 🙂
https://code.visualstudio.com/docs/editing/codebasics#_formatting
currentTime = TimeAs12hours("00:00"); | ||
targetTime = "12:00 am"; | ||
console.assert( | ||
currentTime === targetTime, | ||
`current time:${currentTime}, Target Time:${targetTime}` | ||
); |
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 get the following assertion error on this test case:
Assertion failed: current output: 12:00 am, target output: 12:00 pm
Learners, PR Template
Self checklist
Changelist
I have answered all questions in the Sprint 2
Questions
Can you give me feedback on my answer in Sprint2/5-strech-extend folder