Add "modulo" name in remainder section (#20624)
* Update index.md I refer to it as "modulus" so I thought it would be best to add another name for it. * markdownize links add modulus to to sentence on 75
This commit is contained in:
committed by
Niraj Nandish
parent
5dade1e490
commit
892ec7f81b
@ -18,7 +18,7 @@ JavaScript provides the user with five arithmetic operators: `+`, `-`, `*`, `/`
|
|||||||
5 + "foo" // concatenates the string and the number and returns "5foo"
|
5 + "foo" // concatenates the string and the number and returns "5foo"
|
||||||
"foo" + "bar" // concatenates the strings and returns "foobar"
|
"foo" + "bar" // concatenates the strings and returns "foobar"
|
||||||
|
|
||||||
_Hint:_ There is a handy <a href='https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Increment' target='_blank' rel='nofollow'>increment</a>(++) operator that is a great shortcut when you're adding numbers by 1.
|
_Note:_ There is a handy [increment(++)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Increment) operator that is a great shortcut when you're adding numbers by 1.
|
||||||
|
|
||||||
## Subtraction
|
## Subtraction
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ _Hint:_ There is a handy <a href='https://developer.mozilla.org/en-US/docs/Web/J
|
|||||||
true - 3 // interprets true as 1 and returns -2
|
true - 3 // interprets true as 1 and returns -2
|
||||||
5 - "foo" // returns NaN (Not a Number)
|
5 - "foo" // returns NaN (Not a Number)
|
||||||
|
|
||||||
_Hint:_ There is a handy <a href='https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Decrement_(--' target='_blank' rel='nofollow'>decrement</a>(--) operator that is a great shortcut when you're subtracting numbers by 1.
|
_Note:_ There is a handy [decrement(--)](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#Decrement) operator that is a great shortcut when you're subtracting numbers by 1.
|
||||||
|
|
||||||
## Multiplication
|
## Multiplication
|
||||||
|
|
||||||
@ -72,6 +72,8 @@ _Hint:_ There is a handy <a href='https://developer.mozilla.org/en-US/docs/Web/J
|
|||||||
|
|
||||||
## Remainder
|
## Remainder
|
||||||
|
|
||||||
|
Also referred to as the "modulus" or "modulo" operator.
|
||||||
|
|
||||||
**Syntax**
|
**Syntax**
|
||||||
|
|
||||||
`a % b`
|
`a % b`
|
||||||
@ -124,6 +126,7 @@ _Hint:_ There is a handy <a href='https://developer.mozilla.org/en-US/docs/Web/J
|
|||||||
var a = 9;
|
var a = 9;
|
||||||
var b = 4;
|
var b = 4;
|
||||||
a -= b; //a = 5, b = 4
|
a -= b; //a = 5, b = 4
|
||||||
_!Important!_ As you can see, you **cannot** perform any sort of operations on `Infinity`.
|
|
||||||
|
|
||||||
Source: The amazing <a href='https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators' target='_blank' rel='nofollow'>MDN</a>.
|
_!Important!_ You **cannot** perform any sort of operations on `Infinity`.
|
||||||
|
|
||||||
|
Source: The amazing [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators)
|
||||||
|
Reference in New Issue
Block a user