Skip to content

Instantly share code, notes, and snippets.

@larscmagnusson
larscmagnusson / sort-list-string.js
Created October 19, 2022 06:07
Sort unsorted list
const unsortedString = `
a
c
b
`
const sortedString = [...unsortedString.split('\n')]
.map(x => x.trim())
.filter(x => x)
.sort()
.join('\n')