JSFiddle - React, Tailwind, and code Playground

HTML

<div class="output"></div>

JavaScript

// modulo with big numbers example
// this fiddle wants the big number that needs to be divided as a string 
// then it iterates over the characters to split the remainder up and do
// some magic stuff

var AMOUNT = '39847893457834789597354',
    DIVIDER = 8,
    output = document.querySelector('.output'),

    modulo = function (divident, divisor) {
    var cDivident = '';
    var cRest = '';
    
    for (var i in divident ) {
        var cChar = divident[i];
        var cOperator = cRest + '' + cDivident + '' + cChar;
        
        if ( cOperator < parseInt(divisor, 10) ) {
            cDivident += '' + cChar;
        } else {
            cRest = cOperator % divisor;
            if ( cRest === 0 ) {
                cRest = '';
            }
            cDivident = '';
        }
        
    }
    cRest += '' + cDivident;
    if (cRest === '') {
        cRest = 0;
    }
    return cRest;
};

output.innerHTML = modulo(AMOUNT, DIVIDER);