JSFiddle - React, Tailwind, and code Playground

by f0t0n

JavaScript

var getCharCodes,
    renderCharCodes,
    renderCharCode;


getCharCodes = function(begin, end, rowLength) {
    var charCodes,
        charCode,
        columnNumber,
        row,
        addRow;
    
    charCodes = [];
    charCode = begin;
    
    addRow = function(row) {
        charCodes.push(row);
    };
    
    while(true) {
        columnNumber = 0;
        row = [];
        while(columnNumber < rowLength) {
            row.push(charCode);
            charCode++;
            columnNumber++;
            if(charCode > end) {
                addRow(row);
                return charCodes;
            }
        }
        addRow(row);
    }
};

renderCharCode = function(charCode) {
    return [charCode, String.fromCharCode(charCode)].join(': ');
};


renderCharCodes = function(charCodes) {
    for(var rowNum = 0; rowNum < charCodes.length; rowNum++) {
        console.log(charCodes[rowNum].map(renderCharCode).join('\t'));
    }
};

renderCharCodes(getCharCodes(140, 200, 16));