Improve Concept Exercise: Numbers (Freelancer Rates)
See original GitHub issueGetting started
Here you can read about what Concept Exercises are and how they are structured:
If you have not done so yet, it is probably also helpful to do a couple of “Learning Exercises” (this is how they are called on the site) yourself.
Goal
The goal of this issue is to extend the existing concept exercise Freelancer Rates that teaches the numbers
concept.
The exercise is already in good shape but currently only explicitly introduces numbers as a concept. Additionally it should also introduce arithmetic operators incl. shorthand assignment operators.
See this list for details on the learning curve we are aiming for.
Additional Learning Objectives
- How to do perform the following 6 arithmetic operations: addition, subtraction, multiplication, division, remainder, exponentiation
- What are shorthand assignment operators for those 6 operations and how to use them
(To avoid too many tiny concepts, both of these will be combined in one additional concept called arithmetic-operators
.)
ToDos
Add Concept
- Create a new folder
arithmetic-operators
inconcepts
and add the concept to the general config.json file (incl. adding it toconcepts
for thefreelancer-rates
exercise there) - Write the introduction.md, about.md and links.json file for the concept
Adjust the Concept Exercise
- Add the introduction.md of the concept at the end of the introduction.md file of the exercise, make some adjustments in the content if necessary.
- Adjust the design.md file to incorporate the new learning objectives.
- Update the tasks in the exercise to include at least one use of one of the more unusual operators (
%
or**
) and one sensible use of a shorthand assignment operator. You can add new additional tasks but you can also consider replacing/adjusting an existing task that might currently not teach much more than the other tasks already do. Updating the tasks includes the following files- instructions.md
- hints.md
- exemplar.js
- stub file (freelancer-rates.js)
- test file (freelancer-rates.spec.js)
Fixes for the Existing Content
This part is optional polishing “while you are at it” but can also be tackled in another issue/PR later.
- Fix broken link in “Built-in Object” section
- About.md for numbers could benefit from the following additions:
- explain the 3 special numbers: NaN and +/- Infinity
- show how to write numbers with underscore or exponential notation
- Remove the section on comparison, it is now included in the comparison concept, instead just keep the link (“How to compare numbers is explained in …”)
- The current exercise requires rounding to solve it. The introduction.md of the exercise currently does not include this. It should point the students to a list of the rounding methods, e.g. like this one, so they don’t get lost reading about rounding in JavaScript. Also update the introduction.md of the numbers concept to keep them roughly in sync.
- See comments below for other issues that students found that should be addressed.
Ideas for About.md of the New Concept
/
does not perform integer division like in some other languages- behavior of
%
if one operand is negative, see MDN docs below the demo box - typical use of
%
for keeping a value inside a range/ “if you reach the end while iterating, start from the beginning” (not sure how to describe this well but explanation should also be understandable for someone who does not know ring theory) **
does the same as the olderMath.pow()
Help
You can choose to do this solo-style, or collaborate with multiple people on this. The suggested approach is to
- First accept this issue by saying “I’d like to work on this” (no need to wait for a response, just go with it) and optionally request that someone works with you (and wait for a second person to accept your request).
- Use this issue to discuss any questions you have, what should be included in the content and what not and to collect reference material.
- Create a PR and set “exercism/javascript” as reviewers. Additionally you can write in #maintaining-javascript that your PR is ready for review. Once you incorporated any critical feedback that the reviewer might give you and the PR is approved, it will be merged by a maintainer.
Credit
This contribution grants you an author slot. Add your username to the authors
key in the config file.
Issue Analytics
- State:
- Created 3 years ago
- Comments:28 (25 by maintainers)
Top GitHub Comments
Hi, I just did this exercise and found one part a bit unclear:
I assumed this meant that each full month gets a discount, and any leftover days are billed at the full day rate. But from the expected results in the tests it seems that the discount needs to be applied to all days regardless of whether they make up a full month.
(Apologies if this was clear to everyone else!)
@junedev, I’m glad to have worked on this. This was my first open-source contribution apart from fixing typos and broken links. A personal thank you for your reviews - made me go a long way!
I plan to stay dormant on GitHub for the rest of this month as I have my exams and the courseload is heavy. Hence I think it would be better to move to a new issue so that someone else can work on it or I tackle it later 😃