-
Notifications
You must be signed in to change notification settings - Fork 94
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
Module 1 exercises solved #53
base: master
Are you sure you want to change the base?
Conversation
module-1/classification.js
Outdated
} */ | ||
|
||
// 2nd solution | ||
gradeOfStudent = (0 <= score && score <= 100) ? (score >= 90) ? 5 : (score >= 80) ? 4 : (score >= 70) ? 3 : (score >= 60) ? 2 : 1 : 0; |
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 would recommend elaborating a bit more on this solution and find a more optimized way to solve it.
Let me add some hints: Please digest the functions of Math, especially the Math.ceil()
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 for your hint.
I managed to solve it using the min, max, and ceil functions from the Math object.
I pushed the changes.
@@ -17,7 +17,19 @@ function euclidean(a, b) { | |||
*/ | |||
// PLACE YOUR CODE BETWEEN THIS... | |||
|
|||
|
|||
if (a > 0 && b > 0) { |
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.
The formatting of your code is inconsistent. Well-formatted code is easy to understand and important from maintenance perspective as well. Last but not least, looks cool. Please mind the formatting.
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.
Please can you specify which part of the code is inconsistent?
I reviewed it and I don't see which code snippet is wrong.
// WHEN | ||
// THEN | ||
expect(() => c.divide(0)).to.throw("Division by 0 is not possible!"); | ||
//expect(c.divide.bind(null, 0)).to.throw(); |
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.
Do you still need the commented code snippet?
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.
No, I don't need that many comments in my code.
I changed it, and I left only the essential ones.
package.json
Outdated
@@ -23,7 +23,7 @@ | |||
"dependencies": { | |||
"chai": "^4.2.0", | |||
"cucumber": "^6.0.5", | |||
"mocha": "^7.0.0", | |||
"mocha": "^7.2.0", |
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.
Could you please double-check the goal of semantic versioning of npm? https://semver.npmjs.com/
You can check this video as well :)
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.
Hi,
I installed mocha with npm and it automatically changed the version in the project, although I did not see that change until I pushed it.
Thanks for the video and the link, it helped me a lot. Now I understand it better.
I changed back to "mocha": "^7.0.0", it works fine.
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 is ok to update the versions manually, even if it is handled by semantic versioning, I just wanted to highlight the "tricks" behind them.
I Solved the module 1 exercises.
I also managed to write in one line the exercise with the grades.