Skip to content

Conversation

@szucst
Copy link

@szucst szucst commented Oct 29, 2020

I Solved the module 1 exercises.

I also managed to write in one line the exercise with the grades.

} */

// 2nd solution
gradeOfStudent = (0 <= score && score <= 100) ? (score >= 90) ? 5 : (score >= 80) ? 4 : (score >= 70) ? 3 : (score >= 60) ? 2 : 1 : 0;
Copy link
Collaborator

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()

Copy link
Author

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.

// PLACE YOUR CODE BETWEEN THIS...


if (a > 0 && b > 0) {
Copy link
Collaborator

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.

Copy link
Author

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();
Copy link
Collaborator

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?

Copy link
Author

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
"chai": "^4.2.0",
"cucumber": "^6.0.5",
"mocha": "^7.0.0",
"mocha": "^7.2.0",
Copy link
Collaborator

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 :)

Copy link
Author

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.

Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants