JSFiddle - React, Tailwind, and code Playground

by Brock Callahan

HTML

<div id="output"></div>

JavaScript

var myList = [11, 12, 13, 14, 15];



function sortList(arr, num) {
        if (num < arr[0]) {
            arr.unshift(num);
        } else {
            arr.push(num);
        }
    return arr;
}

function writeIt(id, text) {
    document.getElementById(id).innerHTML = text;
}

writeIt('output', sortList(myList, 10));