Number is divisible

JavaScript, Math · Sep 15, 2020

Checks if the first numeric argument is divisible by the second one.

  • Use the modulo operator (%) to check if the remainder is equal to 0.
const isDivisible = (dividend, divisor) => dividend % divisor === 0;
isDivisible(6, 3); // true

More like this

  • Number is prime

    Checks if the provided integer is a prime number.

    JavaScript, Math · Jan 12, 2021

  • Copy sign to number

    Returns the absolute value of the first number, but the sign of the second.

    JavaScript, Math · Oct 7, 2020

  • Number is even

    Checks if the given number is even.

    JavaScript, Math · Oct 20, 2020