Files
30-seconds-of-code/snippets/divisible-by-number.md
2017-12-12 11:50:06 +01:00

310 B

Divisible by number

Using the module operator % we can check if the reminder is equal to zero. In this case the function returns true. We can use this function for checking if a number is even or odd passing 2 as divisor

var isDivisible = (dividend, divisor) => dividend % divisor === 0;