did a flex-box version: jsfiddle.net/bradleygriffith/2dsag...
<div class="sorted-list" id="my-list"></div>
.sorted-list { align-items: flex-start; display: flex; margin: 0 -5px; } .sorted-list-item { margin: 0 5px; }
const listEl = document.getElementById("my-list"); const arr = [10, 100, 500, 20, 35]; arr.forEach(n => { const itemEl = document.createElement("div"); itemEl.className = "sorted-list-item"; itemEl.innerHTML = n; itemEl.style.order = n; listEl.appendChild(itemEl); });
Ahaha, awesome! 😂
half a second sort for 5 items, very quickly
It's amazing good work
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
did a flex-box version: jsfiddle.net/bradleygriffith/2dsag...
Ahaha, awesome! 😂
half a second sort for 5 items, very quickly
It's amazing
good work