+ 1

What this operator does

%<-- what this operator does?

25th Jun 2017, 1:42 PM
Ilias
Ilias - avatar
2 Respostas
+ 8
It returns the remainder.. the "modulus operator" var a = 8%7; //8 divided by 7 alert(a); //ouput 1
25th Jun 2017, 1:44 PM
Marco Macdon
Marco Macdon - avatar
+ 4
Here's an additional. If the second value is higher, it will return the first value.. var a = 1%8; //returns 1 var b = 5%9; //returns 5 alert(a + b); //output: 6
25th Jun 2017, 1:54 PM
Marco Macdon
Marco Macdon - avatar