JSFiddle - React, Tailwind, and code Playground

HTML

<p>Click the button to sort the array.</p>

<button onclick="myFunction()">Try it</button>

<p id="demo"></p>


<script>
var fruits = [["Banana","Chapter3"], ["Orange","Chapter2"], ["Apple","Chapter1"]];
document.getElementById("demo").innerHTML = fruits;

function myFunction() {
    fruits.sort();
    document.getElementById("demo").innerHTML = fruits;
}
</script>