From 3e7e82233d9643fd1dd7e50bad1faa795c389d2a Mon Sep 17 00:00:00 2001 From: Brian <2048091+briansieb@users.noreply.github.com> Date: Sun, 20 Mar 2022 16:34:58 -0500 Subject: [PATCH 1/2] Solutions to exercises 1, 2 and beginning of 4 --- 01 - JavaScript Drum Kit/index-START.html | 31 ++++++++++++++++++++++- 01 - JavaScript Drum Kit/style.css | 2 +- 02 - JS and CSS Clock/index-START.html | 25 ++++++++++++++++++ 04 - Array Cardio Day 1/index-START.html | 3 +++ 4 files changed, 59 insertions(+), 2 deletions(-) diff --git a/01 - JavaScript Drum Kit/index-START.html b/01 - JavaScript Drum Kit/index-START.html index 4070d32767..c57c0ff326 100644 --- a/01 - JavaScript Drum Kit/index-START.html +++ b/01 - JavaScript Drum Kit/index-START.html @@ -9,6 +9,13 @@
+

+

+ 6 + tink +


+

+

A clap @@ -45,6 +52,7 @@ L tink
+

@@ -56,11 +64,32 @@ + + \ No newline at end of file diff --git a/01 - JavaScript Drum Kit/style.css b/01 - JavaScript Drum Kit/style.css index bfdba84312..6b1ee563cc 100644 --- a/01 - JavaScript Drum Kit/style.css +++ b/01 - JavaScript Drum Kit/style.css @@ -34,7 +34,7 @@ body,html { .playing { transform: scale(1.1); - border-color: #ffc600; + border-color: #0004ff; box-shadow: 0 0 1rem #ffc600; } diff --git a/02 - JS and CSS Clock/index-START.html b/02 - JS and CSS Clock/index-START.html index 7a6d27d5bd..b337b7c610 100644 --- a/02 - JS and CSS Clock/index-START.html +++ b/02 - JS and CSS Clock/index-START.html @@ -62,13 +62,38 @@ background: black; position: absolute; top: 50%; + transform-origin: 100%; + transform: rotate(90deg); + transition: all 0.05s; + transition-timing-function: cubic-bezier(0.1, 2.7, 0.58, 1); } diff --git a/04 - Array Cardio Day 1/index-START.html b/04 - Array Cardio Day 1/index-START.html index 21bec96e8c..e03ef39dcd 100644 --- a/04 - Array Cardio Day 1/index-START.html +++ b/04 - Array Cardio Day 1/index-START.html @@ -37,6 +37,9 @@ // Array.prototype.filter() // 1. Filter the list of inventors for those who were born in the 1500's + const inventorsBornIn1500s = inventors.filter(inventor => inventor.year >= 1500 && inventor.year < 1600); + + console.table(inventorsBornIn1500s); // Array.prototype.map() // 2. Give us an array of the inventors first and last names From 8beece47e854cfa73abf61c48d2f64a58bc3add6 Mon Sep 17 00:00:00 2001 From: Brian <2048091+briansieb@users.noreply.github.com> Date: Sat, 26 Mar 2022 14:06:59 -0500 Subject: [PATCH 2/2] Exercise 7 solution: Array Cardio Day 2 --- 07 - Array Cardio Day 2/index-START.html | 25 ++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/07 - Array Cardio Day 2/index-START.html b/07 - Array Cardio Day 2/index-START.html index 969566ff78..4722fa0c0e 100644 --- a/07 - Array Cardio Day 2/index-START.html +++ b/07 - Array Cardio Day 2/index-START.html @@ -26,15 +26,40 @@ // Some and Every Checks // Array.prototype.some() // is at least one person 19 or older? + const currentYear = new Date().getFullYear(); + + function isPersonOver19(birthYear) { + return (currentYear - birthYear) >= 19; + } + + const isOnePersonOver19 = people.some(person => isPersonOver19(person.year)); + console.log({isOnePersonOver19}); + // Array.prototype.every() // is everyone 19 or older? + const isEveryoneOver19 = people.every(person => isPersonOver19(person.year)); + console.log({isEveryoneOver19}); + // Array.prototype.find() // Find is like filter, but instead returns just the one you are looking for // find the comment with the ID of 823423 + const commentWithId = comments.find(comment => comment.id === 823423); + console.log(commentWithId.text); // Array.prototype.findIndex() // Find the comment with this ID // delete the comment with the ID of 823423 + const arrayIndex = comments.findIndex(comment => comment.id === 823423); + // comments.splice(arrayIndex, 1); + + const newComments = [ + ...comments.slice(0, arrayIndex), + ...comments.slice(arrayIndex + 1) + ]; + + console.table(comments); + + console.table(newComments);