array = array.map(i => i + Math.floor(Math.random() * 100));
<div id="sort"></div>
<button id="btn">Sort</button>
<script>
const sortArr = document.getElementById('sort')
const sortBtn = document.getElementById('btn')
const points = [40, 100, 1, 5, 25, 10];
sortArr.innerHTML = points
const newArr = points.map(i => i + Math.floor(Math.random() * 100))
const sortListArr = () => {
const sign = ((newArr[0] > newArr[newArr.length - 1]) ? 1 : -1);
const sortedArr = [...newArr].sort((a, b) => (sign * (a - b)));
return sortArr.innerHTML = sortedArr;
}
sortBtn.addEventListener('click', sortListArr)