<ul>
<li><a href="#">Link1</a></li>
<li><a href="#">Link2</a></li>
<li><a href="#">Link3</a></li>
<li><a href="#">Link4</a></li>
</ul>
let [...sortLinks] = document.querySelectorAll('ul li')
sortLinks.reverse()
const parent = document.querySelector('ul');
.parent.querySelectorAll(':scope > *').forEach(n => parent.prepend(n));
// или
Element.prototype.append.apply(parent, [...parent.children].reverse());
// или
const [ first, ...rest ] = parent.children;
first?.before(...rest.reverse());
// или
for (const n of parent.children) {
parent.insertBefore(n, parent.firstElementChild);
}
// или
for (let i = parent.children.length; i--;) {
parent.insertAdjacentElement('beforeend', parent.children[i]);
}
// или
const elems = Array.from(parent.children);
while (elems.length) {
parent.appendChild(elems.pop());
}