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.
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.
Thanks for your hint.
I managed to solve it using the min, max, and ceil functions from the Math object.
I pushed the changes.
| // PLACE YOUR CODE BETWEEN THIS... | ||
|
|
||
|
|
||
| if (a > 0 && b > 0) { |
There was a problem hiding this comment.
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.
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.
Do you still need the commented code snippet?
There was a problem hiding this comment.
No, I don't need that many comments in my code.
I changed it, and I left only the essential ones.
package.json
Outdated
| "chai": "^4.2.0", | ||
| "cucumber": "^6.0.5", | ||
| "mocha": "^7.0.0", | ||
| "mocha": "^7.2.0", |
There was a problem hiding this comment.
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.
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.
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.