-
-
Notifications
You must be signed in to change notification settings - Fork 437
London10-StellaDelMar_RodriguezFernandez-JavaScript-Core-1-Coursework-Week2 #457
base: main
Are you sure you want to change the base?
Conversation
//from 7 to 1 | ||
let number = 7; | ||
function countReverse(number) { | ||
while (number >= 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.
So for this one, using a while loop where will probably result in an infinite loop (more on this here), if the number is greater than 10. Otherwise, this will not run as the number would be less than 10 (for example in your number = 7 example, this wouldn't return anything because the number is less than 10).
You might want to think about using a for loop here:
for (let i = number; i > 0; i--)
else if (age >= 90 ){ | ||
return "You Don't Need To Register"; } | ||
|
||
} |
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.
Awesome! nice work on this one 🎉
} else if (price2 > price1){ | ||
return price2; | ||
} | ||
//console.log("price is"); |
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.
nice job using an if statement here.
LGTM! (here is the meaning if this acronym!)
while (limit <= 10){ | ||
console.log(limit); | ||
} limit = limit + 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.
Looks like we might have another infinite loop here (docs here). Maybe have a quick review on how while loops work? they can be a bit tricky.
//let totalPrice = 150; | ||
function applyDiscount(totalPrice) { | ||
if (totalPrice >200){ | ||
return (totalPrice - totalPrice * 0.01); |
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.
nice job with the if statement!
Just might want to check your maths on this one 😉
0.01 would be 1% and 0.1 would be a 10%, but where is our 5% discount? 😜
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.
Thanks. I understand 😅
return true; | ||
} else { | ||
return false; | ||
} |
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.
Nice one!
Hi @Stelladelmar! Thanks for putting in this PR! That's great :) Very happy you were able to get this in and a lot of really good work! I can see you have really been practicing. I have left some comments for you. The one thing I would say you might want to take another look at is your while loops. We can review this concept if you have any questions, but in the meantime take a look back through the videos and some of the documentation. Again, great work and keep it up! Looking forward to your next one :) |
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?