JSFiddle - React, Tailwind, and code Playground

HTML

<input type="button" onclick="go();" value="go">
    
    <script>
        function go() {
    var str = "apples and bananas";
    
    var newString = "";
    
    var d = new Date();
    var n = (d.getSeconds() * 1000) + d.getMilliseconds();
    
    for (var x = 0; x < 1000000; x++) {
        newString = str.replace("bananas", "oranges");
        newString = newString + x;
    }
    
    var d2 = new Date();
    var n2 = (d2 .getSeconds() * 1000) + d2.getMilliseconds();
    
        //console.log("First: " + n + " Second: " + n2 + " Total: " + (n2 - n));
        alert("First: " + n + " Second: " + n2 + " Total: " + (n2 - n) + " Output: " + newString);
    
}
    </script>