JSFiddle - React, Tailwind, and code Playground

HTML

<div>
    height: <input id="height" />
    <button id="setHeight">Set Height</button>
    <button id="findMax">Find Max</button>
</div>
<div id="inner"></div>

CSS

#inner {
    background: CornflowerBlue;
}

JavaScript

inner = document.getElementById('inner');

heightInput = document.getElementById('height');

document.getElementById('findMax').onclick = function() {
    var increment = 100000000;
    var height = increment;

    while (increment >= 1) {
        while (setHeight(height)) {
            height += increment;
            if(height > 10000000000) {
                alert("REALLY BIG");
                return;
            }
        }
        height -= increment;
        increment /= 10;
    }
    setHeight(height--);
};

document.getElementById('setHeight').onclick = function() {
    setHeight(heightInput.value);
}
    
setHeight = function(height) {
    inner.style.height = height + "px";
    heightInput.value = height;
    return inner.clientHeight;
};

setHeight(200);