• #Modulo in js

    const mod = (n, m) => ((n % m) + m) % m;
    

    as % (reminder operation) does not work as expected with negative numbers