SyntaxFix
Write A Post
Hire A Developer
Questions
You can also do this
d = [20, 30, 10] e = Array.from(d) e.sort()
This way d will not get mutated.
function sorted(arr) { temp = Array.from(arr) return temp.sort() } //Use it like this x = [20, 10, 100] console.log(sorted(x))