-
-
Notifications
You must be signed in to change notification settings - Fork 438
Glasgow_6 - Ehdaa_Sakawi - javaScript - Week_2 #453
base: main
Are you sure you want to change the base?
Conversation
@@ -10,7 +10,7 @@ | |||
|
|||
*/ | |||
|
|||
function getMood() { | |||
function getMood(isHappy) { | |||
let isHappy = true; |
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 this correct? When you ran your unit tests locally did they pass for you?
@@ -21,7 +21,7 @@ function getMood() { | |||
} | |||
|
|||
function greaterThan10(num) { | |||
let isBigEnough; | |||
let isBigEnough = num >= 10; |
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.
Looks good but here's a question: Is num >= 10
going to assert that the num is greater than 10?
function isAcceptableUser(userAge, isLoggedIn) { | ||
if (userAge >= 18 && isLoggedIn){ | ||
return "is acceptable" | ||
} | ||
} |
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.
Not bad but do we need to know when user is not acceptable?
function applyDiscount(totalPrice) { | ||
if(totalPrice>200){ | ||
discount=10;} | ||
else{ discount=5; | ||
|
||
} | ||
return totalPrice-( totalPrice * discount / 100); |
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.
Good effort, can we make this code a bit more readable by formatting your if statement?
function buyTwoGetTheCheapestFree(price1, price2) { | ||
let totalPrice = price1 + price2; | ||
if (price1 < price2){ | ||
let discount = price1; | ||
} | ||
return totalPrice - price1; | ||
} |
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.
When you ran your unit tests did they pass for you?
consider following
buyTwoGetCheapestFree(200,100)
would your code still work correctly?
|
||
|
||
|
||
} | ||
|
||
/* | ||
Complete the function so that it prints out to the console numbers in reverse order starting at |
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.
Looks like you have missed 1 more step of your assignment function countReverse(number) {}
Volunteers: Are you marking this coursework? You can find a guide on how to mark this coursework in
HOW_TO_MARK.md
in the root of this repositoryYour Details
Homework Details
Notes
What did you find easy?
What did you find hard?
What do you still not understand?
Any other notes?