Skip to content

Commit e161666

Browse files
committed
Complete Day 17 - Sort Without Articles
1 parent 2d81d00 commit e161666

3 files changed

Lines changed: 8 additions & 64 deletions

File tree

3.48 MB
Loading

17 - Sort Without Articles/index-START.html

Lines changed: 0 additions & 56 deletions
This file was deleted.

17 - Sort Without Articles/index-FINISHED.html renamed to 17 - Sort Without Articles/index.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
<head>
44
<meta charset="UTF-8">
55
<title>Sort Without Articles</title>
6-
<link rel="icon" href="https://fav.farm/" />
6+
<link rel="icon" href="https://fav.farm/🔥" />
77
</head>
88
<body>
99

1010
<style>
1111
body {
1212
margin: 0;
1313
font-family: sans-serif;
14-
background: url("https://source.unsplash.com/nDqA4d5NL0k/2000x2000");
14+
background: url('./image.jpg');
1515
background-size: cover;
1616
display: flex;
1717
align-items: center;
@@ -21,15 +21,15 @@
2121
#bands {
2222
list-style: inside square;
2323
font-size: 20px;
24-
background: white;
24+
background: rgb(255, 248, 238);
2525
width: 500px;
2626
margin: auto;
2727
padding: 0;
2828
box-shadow: 0 0 0 20px rgba(0, 0, 0, 0.05);
2929
}
3030

3131
#bands li {
32-
border-bottom: 1px solid #efefef;
32+
border-bottom: 2px solid #000000;
3333
padding: 20px;
3434
}
3535

@@ -50,18 +50,18 @@
5050
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'];
5151

5252
function strip(bandName) {
53-
return bandName.replace(/^(a |the |an )/i, '').trim();
53+
return bandName.replace(/^(a |the |an )/i).trim();
5454
}
55+
const sortedBands = bands.sort((a, b) => strip(a) < strip(b) ? 1: -1);
5556

56-
const sortedBands = bands.sort((a, b) => strip(a) > strip(b) ? 1 : -1);
57-
58-
document.querySelector('#bands').innerHTML =
57+
document.querySelector('#bands').innerHTML =
5958
sortedBands
6059
.map(band => `<li>${band}</li>`)
6160
.join('');
6261

6362
console.log(sortedBands);
6463

64+
6565
</script>
6666

6767
</body>

0 commit comments

Comments
 (0)