Visitar URL original
start project #17. clean up #16. #17 is not right. · jdstein1/JavaScript30@2a2e996 · GitHub
Skip to content

Commit 2a2e996

Browse files
committed
start project wesbos#17. clean up wesbos#16. wesbos#17 is not right.
1 parent bd78fea commit 2a2e996

5 files changed

Lines changed: 92 additions & 16 deletions

File tree

‎16--Mouse_Move_Shadow/debounce.js‎

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

‎16--Mouse_Move_Shadow/index-jds.html‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ <h1 class="header" contenteditable>cmyk</h1>
4343
}
4444
</style>
4545

46-
<script src="debounce.js"></script>
4746
<script>
4847

4948
const hero = document.querySelector('.hero');
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Sort Without Articles</title>
6+
</head>
7+
<body>
8+
9+
<style>
10+
body {
11+
font-family: sans-serif;
12+
background: url("https://source.unsplash.com/nDqA4d5NL0k/2000x2000");
13+
background-size: cover;
14+
display: flex;
15+
align-items: center;
16+
min-height: 100vh;
17+
}
18+
19+
#bands {
20+
list-style: inside square;
21+
font-size: 20px;
22+
background: white;
23+
width: 500px;
24+
margin: auto;
25+
padding: 0;
26+
box-shadow: 0 0 0 20px rgba(0, 0, 0, 0.05);
27+
}
28+
#bands li {
29+
border-bottom: 1px solid #efefef;
30+
padding: 20px;
31+
}
32+
#bands li:last-child {
33+
border-bottom: 0;
34+
}
35+
36+
a {
37+
color: #ffc600;
38+
text-decoration: none;
39+
}
40+
41+
</style>
42+
43+
<ul id="bands"></ul>
44+
45+
<script>
46+
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'];
47+
console.log(bands);
48+
const articles = ['a ','an ','the '];
49+
// const bandsSorted = bands.sort();
50+
const bandsMapped = bands.map(band => {
51+
band = band.toLowerCase();
52+
// console.group('START bandsSorted: ', band);
53+
for (var i = 0; i < articles.length; i++) {
54+
console.log('\"'+articles[i]+'\" @ '+band.indexOf(articles[i]));
55+
// console.log(band.indexOf(articles[i]));
56+
}
57+
if (band.indexOf('a ') === 0) {
58+
return band.substring(2);
59+
} else if (band.indexOf('an ') === 0) {
60+
return band.substring(3);
61+
} else if (band.indexOf('the ') === 0) {
62+
return band.substring(4);
63+
} else {
64+
return band;
65+
}
66+
// console.groupEnd();
67+
});
68+
console.log(bandsMapped);
69+
const bandsSorted = bandsMapped.sort();
70+
console.log(bandsSorted);
71+
72+
</script>
73+
74+
</body>
75+
</html>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Sort Without Articles</title>
6+
</head>
7+
<body>
8+
9+
<ul>
10+
<li><a href="index-START.html">START</a></li>
11+
<li><a href="index-FINISHED.html">FINISHED</a></li>
12+
<li><a href="index-jds.html">jds</a></li>
13+
</ul>
14+
15+
</body>
16+
</html>

‎index.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<li><a href="14--JavaScript_References_VS_Copying/index.html">14 - JavaScript References VS Copying</a></li>
2424
<li><a href="15--LocalStorage/index.html">15 - LocalStorage</a></li>
2525
<li><a href="16--Mouse_Move_Shadow/index.html">16 - Mouse Move Shadow</a></li>
26-
<!-- <li><a href="17--Sort_Without_Articles/index.html">17 - Sort Without Articles</a></li> -->
26+
<li><a href="17--Sort_Without_Articles/index.html">17 - Sort Without Articles</a></li>
2727
<!-- <li><a href="18--Adding_Up_Times_with_Reduce/index.html">18 - Adding Up Times with Reduce</a></li> -->
2828
<!-- <li><a href="19--Webcam_Fun/index.html">19 - Webcam Fun</a></li> -->
2929
<!-- <li><a href="20--Speech_Detection/index.html">20 - Speech Detection</a></li> -->

0 commit comments

Comments
 (0)