function solution7(n) { const newArr = String(n).split(""); newArr.sort((a, b) => b - a); return Number(newArr.join("")); } console.log(solution7(118372)); // 873211