This content originally appeared on CodeSource.io and was authored by Ariessa Norramli
In this article, you will learn how to get a division remainder in Javascript.
Let’s say you have 2 numbers.
var a = 100;
var b = 26;
Get Division Remainder
In order to get a division remainder, you can use the modulo operator, %
.
var a = 100;
var b = 26;
console.log(a + " % " + b + " = " + a % b);
// => "100 % 26 = 22"
Note: The modulo operator, %
functions by returning the remainder in an arithmetic division.
The post How to Get Division Remainder in Javascript appeared first on CodeSource.io.
This content originally appeared on CodeSource.io and was authored by Ariessa Norramli
Ariessa Norramli | Sciencx (2021-03-06T13:21:46+00:00) How to Get Division Remainder in Javascript. Retrieved from https://www.scien.cx/2021/03/06/how-to-get-division-remainder-in-javascript/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.