JSFiddle - React, Tailwind, and code Playground

by jquerybyexample

HTML

<br/>
<h2> Numbers in Array before sorting</h2>
<p id="allnumber"></p>
<br/>
<h2> Numbers in Array After sorting</h2>
<p id="sorted"></p>

CSS

body 
{
    font-family: Arial;
    margin: 5px;
}

p
{
  font-size:10pt;
}

JavaScript

$(document).ready(function() {
  var list= [ 45, 32, 98, 24, 16, 9, 3];
  $('#allnumber').html(list.join("<br />"));
  list = list.sort(function(a,b){
        return a-b;
    });
  $('#sorted').html(list.join("<br />"));
})