Discussion, Questions, and Resources for Part 1 (JavaScript - April 2018 Cohort)

Great resources so far! :sunny: Since this topic will be used for the next 22 days and potentially many more resources will be shared and replies created, you all may want to add your links to the first post above so they’re easier to find. It’s not totally necessary, though, since Discourse has a nice way of listing all of the links in the topic:

Screenshot

That said, your links may be easier for future visitors to find if they’re listed in the first post above, but it’s not necessary.

In terms of JavaScript and something I noticed while going through the curriculum today …

In the Basic JavaScript: Finding a Remainder in JavaScript, there’s a note about the remainder operator:

Note
The remainder operator is sometimes incorrectly referred to as the “modulus” operator. It is very similar to modulus, but does not work properly with negative numbers.

I didn’t know it wasn’t a true modulo in JavaScript as I’m used to calling the % operator the modulo operator and assuming it works that way. MDN confirms this:

Remainder (%)

The remainder operator returns the remainder left over when one operand is divided by a second operand. It always takes the sign of the dividend, not the divisor. It uses a built-in modulo function to produce the result, which is the integer remainder of dividing var1 by var2 — for example — var1 modulo var2. There is a proposal to get an actual modulo operator in a future version of ECMAScript, the difference being that the modulo operator result would take the sign of the divisor, not the dividend.

Wikipedia’s Common Pitfalls of the Modulo Operation section shows an example of what to look out for when using JavaScript’s remainder operator (%).

2 Likes