+ 2

Why we use modulo (remainder) in javascript

9th Apr 2023, 3:49 PM
Tahsin
Tahsin - avatar
5 Answers
+ 11
Not only in Javascript, modulo operator is used in all programming languages while using mathematical function. As you already have it in your question as a name (remainder). I believe you know well, in your calculations "when you get the remainder output?" It's simple maths and nothing else.
9th Apr 2023, 4:28 PM
D Shah šŸŽÆā³ļø
D Shah šŸŽÆā³ļø - avatar
+ 12
Tahsin , a very common use of the modulo operator % is to check if a number is even or odd. https://code.sololearn.com/cvxW2SWJ8CAZ/?ref=app
9th Apr 2023, 6:37 PM
Lothar
Lothar - avatar
+ 8
You have 5 boxes, and 70 sweets. In each box you can place 10 sweets. How many sweets are left if you fill in all 5 boxes? How many more boxes will you need so you don't have any sweets left? Think about this and you will be able to get an answer to your question. Alternatively you can search it up.
9th Apr 2023, 4:03 PM
Lamron
Lamron - avatar
+ 8
Tahsin Already you are learning Web development fundamentals in that course Javascript is there. Learn course your doubts will get cleared.
9th Apr 2023, 5:12 PM
RšŸšŸ‡®šŸ‡³
RšŸšŸ‡®šŸ‡³ - avatar
+ 7
D Shah šŸŽÆā³ļø My first line was same when going to give answer.
9th Apr 2023, 4:38 PM
AĶ¢J
AĶ¢J - avatar