Problem to understand modulo operator in javascript

Title says it all, but i cant understand Modulo operator with % i tried a lot and could not get this equation right (10+22)%3
here is what i tried:
100 % 7 = 2
// a = 100, n = 7
100 - (7 * floor(100/7)) = 2
VM393:1 Uncaught SyntaxError: Invalid left-hand side in assignment
console.log(10+22)%3
VM399:1 32
NaN
console.log(4+5)*2
VM417:1 9
NaN
console.log(5 / 5 )
VM461:1 1
undefined
console.log(5 / 2 )
VM473:1 2.5
undefined
console.log(9 / 4 )
VM503:1 2.25
undefined
console.log(10 + 22 )
VM574:1 32
undefined
console.log(10 + 22 )%3
VM599:1 32

Thanks…

1 Like

console.log(10 + 22 )%3
VM676:1 32
NaN

this what i am getting
what i am doing wrong please someone?

1 Like

Hello sir the error is in the parameters order of your console.log
It should go this way
console.log((10+22)%3)
Your error is on the way you are typing the parameters for the function.
Should always be for example:
function(parameters)
For complex operations like your:
function((A+B)%C)

Hope you find this useful.
If you have any more questions, please let us know so we can help you! :slight_smile:

Carlos Z.

2 Likes

Hiii, thanks for answer I get it now! :slight_smile: Thank you very much

1 Like