Visitar URL original
Get a load of this one liner... · wesbos/JavaScript30@032fd98 · GitHub
Skip to content

Commit 032fd98

Browse files
authored
Get a load of this one liner...
1 parent 0db7e6b commit 032fd98

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

‎17 - Sort Without Articles/index-START.html‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,7 @@
4444
<ul id="bands"></ul>
4545

4646
<script>
47-
const bands = ['The Plot in You', 'The Devil Wears Prada', 'Pierce the Veil', 'Norma Jean', 'The Bled', 'Say Anything', 'The Midway State', 'We Came as Romans', 'Counterparts', 'Oh, Sleeper', 'A Skylit Drive', 'Anywhere But Here', 'An Old Dog'];
48-
49-
47+
document.querySelector('#bands').innerHTML = ['The Plot in You', 'The Devil Wears Prada', 'Pierce the Veil', 'Norma Jean', 'The Bled', 'Say Anything', 'The Midway State', 'We Came as Romans', 'Counterparts', 'Oh, Sleeper', 'A Skylit Drive', 'Anywhere But Here', 'An Old Dog'].sort((a, b) => (a.replace(/^(a |the |an)/i, '').trim() > b.replace(/^(a |the |an)/i, '').trim()) ? 1 : -1).map((b) => `<li>${b}</li>`).join('');
5048
</script>
5149

5250
</body>

0 commit comments

Comments
 (0)