Skip to content
This repository has been archived by the owner on Jan 14, 2024. It is now read-only.

Glasgow_6 - Ehdaa_Sakawi - javaScript - Week_2 #453

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Ehdaa-Munier
Copy link

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 repository

Your Details

  • Your Name:
  • Your City:
  • Your Slack Name:

Homework Details

  • Module:
  • Week:

Notes

  • What did you find easy?

  • What did you find hard?

  • What do you still not understand?

  • Any other notes?

@@ -10,7 +10,7 @@

*/

function getMood() {
function getMood(isHappy) {
let isHappy = true;
Copy link

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;
Copy link

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?

Comment on lines +7 to +11
function isAcceptableUser(userAge, isLoggedIn) {
if (userAge >= 18 && isLoggedIn){
return "is acceptable"
}
}
Copy link

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?

Comment on lines +22 to +28
function applyDiscount(totalPrice) {
if(totalPrice>200){
discount=10;}
else{ discount=5;

}
return totalPrice-( totalPrice * discount / 100);
Copy link

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?

Comment on lines +48 to +54
function buyTwoGetTheCheapestFree(price1, price2) {
let totalPrice = price1 + price2;
if (price1 < price2){
let discount = price1;
}
return totalPrice - price1;
}
Copy link

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
Copy link

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) {}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants