diff --git a/Week1/MAKEME.md b/Week1/MAKEME.md
index 787b50988..f2ddc3fe4 100644
--- a/Week1/MAKEME.md
+++ b/Week1/MAKEME.md
@@ -115,14 +115,11 @@ Follow the steps. Make sure that each step is written on the line after.
**Exercise 8: Type checker**
-Write a program that checks the data types of two variables and logs to the console `SAME TYPE` if they are the same type. If they are different types log `Not the same...`.
+Write a program that checks the data types of two variables and logs to the console `SAME TYPE` if they are the same type. If they are different types log `NOT THE SAME TYPE`.
+1. Find out how to check the type of a variable
1. Declare 4 variables: 2 must be `strings` and 2 must be `objects`
-2. Create 6 conditional statements, where for each you check if the data type of one variable is the same as the other
-3. Find out how to check the type of a variable
-4. Write 2 `console.log` statements to log the type of 2 variables, each with a different data type
-5. Now compare the types of your different variables with one another
-6. Log `Not the same...` when the types are different
+2. Create 6 conditional statements, where for each you check if the data type of one variable is the same as the other and then console.log "SAME TYPE" if they are the same type and "NOT THE SAME TYPE" if they are not.
Here's an incomplete example of how it could look:
diff --git a/Week1/homework/codeAlong/calculator/index.html b/Week1/homework/codeAlong/calculator/index.html
new file mode 100644
index 000000000..48d15cb63
--- /dev/null
+++ b/Week1/homework/codeAlong/calculator/index.html
@@ -0,0 +1,75 @@
+
+
+
+
+
+
+
+
+
+
+ Stefanos' Javascript Calculator
+
+
+
+
+
+
+
+
+ AC
+
+ ÷
+
+
+ 7
+ 8
+ 9
+ ×
+
+
+ 4
+ 5
+ 6
+ -
+
+
+ 1
+ 2
+ 3
+ +
+
+
+ 0
+ 00
+ .
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Week1/homework/codeAlong/calculator/main.js b/Week1/homework/codeAlong/calculator/main.js
new file mode 100644
index 000000000..2e6066b2f
--- /dev/null
+++ b/Week1/homework/codeAlong/calculator/main.js
@@ -0,0 +1,122 @@
+class Calculator {
+ constructor(previousOperandTextElement, currentOperandTextElement) {
+ this.previousOperandTextElement = previousOperandTextElement
+ this.currentOperandTextElement = currentOperandTextElement
+ this.clear()
+ }
+
+ clear() {
+ this.currentOperand = ""
+ this.previousOperand = ""
+ this.operation = undefined
+ }
+
+ delete() {
+ this.currentOperand = this.currentOperand.toString().slice(0, -1)
+
+ }
+
+ appendNumber(number) {
+ if (number === "." && this.currentOperand.includes(".")) return
+ this.currentOperand = this.currentOperand.toString() + number.toString()
+ }
+
+ chooseOperation(operation) {
+ if (this.currentOperand === "") return
+ if (this.previousOperand !== "") {
+ this.compute()
+ }
+ this.operation = operation
+ this.previousOperand = this.currentOperand
+ this.currentOperand = ""
+ }
+
+ compute() {
+ let computation
+ const prev = parseFloat(this.previousOperand)
+ const curr = parseFloat(this.currentOperand)
+ if (isNaN(prev) || isNaN(curr)) return
+ switch (this.operation) {
+ case "+":
+ computation = prev + curr
+ break;
+ case "-":
+ computation = prev - curr
+ break;
+ case "×":
+ computation = prev * curr
+ break;
+ case "÷":
+ computation = prev / curr
+ break;
+ default:
+ return
+ }
+ this.currentOperand = computation
+ this.operation = undefined
+ this.previousOperand = ""
+
+ }
+
+ getDisplayNumber(number) {
+ const stringNumber = number.toString()
+ const integerDigits = parseFloat(stringNumber.split(".")[0])
+ const decimalDigits = stringNumber.split(".")[1]
+ let integerDisplay
+ if (isNaN(integerDigits)) {
+ integerDisplay = ""
+ } else {
+ integerDisplay = integerDigits.toLocaleString("en", { maximumFractionDigits: 0 })
+ }
+ if (decimalDigits != null) {
+ return `${integerDisplay}.${decimalDigits}`
+ } else {
+ return integerDisplay
+ }
+ }
+
+ updateDisplay() {
+ this.currentOperandTextElement.innerText = this.getDisplayNumber(this.currentOperand)
+ if (this.operation != null) {
+ this.previousOperandTextElement.innerText = `${this.getDisplayNumber(this.previousOperand)} ${this.operation}`
+ } else {
+ this.previousOperandTextElement.innerText = ""
+ }
+ }
+}
+
+const numberButtons = document.querySelectorAll('[data-number]');
+const operationButtons = document.querySelectorAll('[data-operation]');
+const equalsButton = document.querySelector('[data-equals]');
+const deleteButton = document.querySelector('[data-delete]');
+const allClearButton = document.querySelector('[data-all-clear]');
+const previousOperandTextElement = document.querySelector('[data-previous-operand]');
+const currentOperandTextElement = document.querySelector('[data-current-operand]');
+
+const calculator = new Calculator(previousOperandTextElement, currentOperandTextElement)
+
+numberButtons.forEach(button => {
+ button.addEventListener("click", () => {
+ calculator.appendNumber(button.innerText)
+ calculator.updateDisplay()
+ })
+})
+operationButtons.forEach(button => {
+ button.addEventListener("click", () => {
+ calculator.chooseOperation(button.innerText)
+ calculator.updateDisplay()
+ })
+})
+equalsButton.addEventListener("click", button => {
+ calculator.compute()
+ calculator.updateDisplay()
+})
+allClearButton.addEventListener("click", button => {
+ calculator.clear()
+ calculator.updateDisplay()
+})
+deleteButton.addEventListener("click", button => {
+ calculator.delete()
+ calculator.updateDisplay()
+})
+
diff --git a/Week1/homework/codeAlong/calculator/style.css b/Week1/homework/codeAlong/calculator/style.css
new file mode 100644
index 000000000..efbf361d4
--- /dev/null
+++ b/Week1/homework/codeAlong/calculator/style.css
@@ -0,0 +1,94 @@
+@import url('https://fonts.googleapis.com/css?family=Orbitron&display=swap');
+@import url('https://fonts.googleapis.com/css?family=Montserrat&display=swap');
+
+
+html{height:100%;}
+
+body {
+ background: rgb(162,159,139);
+ background: radial-gradient(circle, rgba(162,159,139,1) 0%, rgba(214,212,195,1) 0%, rgba(162,159,139,1) 100%);
+}
+
+
+div.background{
+ background-color:#55818D;
+ width: 290px;
+ min-height:500px;
+ position: center;
+ margin-top: 25px;
+ border-radius: 4%;
+ padding-top: 10px;
+ padding-bottom: 10px;
+}
+div.screen {
+ width:300px;
+ min-height: 120px;
+ max-height: 160px;
+ background-color: rgba(0,0,0,0.9);
+ border: 1px solid black;
+ font-family: 'Orbitron', sans-serif;
+ letter-spacing:2px;
+ text-align: right;
+ display: flex;
+ align-items: flex-end;
+ justify-content: space-around;
+ flex-direction: column;
+ padding: 10px;
+ word-wrap: break-word;
+ word-break: break-all;
+ overflow: hidden;
+
+}
+div.previous-operand {
+ color: rgba(255,255,255,0.6);
+ font-size: 1.2rem;
+}
+div.current-operand {
+ color: white;
+ font-size: 2.0rem;
+}
+
+button {
+ width:60px;
+ height:60px;
+ background-color: #172027!important;
+ font-family: 'Montserrat', sans-serif;
+ font-size: 1.4rem!important;
+ font-weight: bolder!important;
+ outline: none;
+}
+button:hover {
+ background-color: #283742!important;
+ border: 1px solid #283742!important;
+}
+button:active {
+ background-color: #475d6d!important;
+ border: 1px solid #475d6d!important;
+}
+
+button.equals {
+ background-color: #fa5f18!important;
+ border: 1px solid #fa5f18!important;
+}
+
+button.equals:hover {
+ background-color: #f7814a!important;
+ border: 1px solid #f7814a!important;
+}
+button.equals:active {
+ background-color: #f59b72!important;
+ border: 1px solid #f59b72!important;
+}
+button.clear {
+ color: rgb(236, 60, 60);
+ width: 128px;
+}
+button.clear:hover{
+ color: rgb(250, 86, 86);
+}
+button.clear:focus{
+ color: rgb(250, 103, 103);
+}
+button.clear:active {
+ color: rgb(250, 103, 103);
+}
diff --git a/Week1/homework/index.html b/Week1/homework/index.html
deleted file mode 100644
index e69de29bb..000000000
diff --git a/Week1/homework/js-exercises/animalsArray.js b/Week1/homework/js-exercises/animalsArray.js
new file mode 100644
index 000000000..af44d22b8
--- /dev/null
+++ b/Week1/homework/js-exercises/animalsArray.js
@@ -0,0 +1,9 @@
+"use strict";
+let items = [];
+console.log("[]");
+console.log(items);
+let animals = ["cat", "dog", "rabbit"];
+console.log(animals);
+animals.push("piglet");
+console.log(animals);
+
diff --git a/Week1/homework/js-exercises/compareArrays.js b/Week1/homework/js-exercises/compareArrays.js
new file mode 100644
index 000000000..7b7e55676
--- /dev/null
+++ b/Week1/homework/js-exercises/compareArrays.js
@@ -0,0 +1,7 @@
+"use strict";
+//Variables
+let array1 = ["A", "B", "C", "D"];
+let array2 = [1, 2, 3, 4, 5, 6, 7];
+//Console log
+console.log(array1.length);
+console.log(array2.length);
\ No newline at end of file
diff --git a/Week1/homework/js-exercises/errorDebug.js b/Week1/homework/js-exercises/errorDebug.js
new file mode 100644
index 000000000..4a76173c3
--- /dev/null
+++ b/Week1/homework/js-exercises/errorDebug.js
@@ -0,0 +1,2 @@
+'use strict'
+console.log("I'm awesome");
\ No newline at end of file
diff --git a/Week1/homework/js-exercises/helloWorld.js b/Week1/homework/js-exercises/helloWorld.js
new file mode 100644
index 000000000..ef3b16076
--- /dev/null
+++ b/Week1/homework/js-exercises/helloWorld.js
@@ -0,0 +1,12 @@
+'use strict'
+console.log("Hello, world!");//English
+console.log("Hola, mundo!");//Spanish
+console.log("Ciao, mondo!");//Italian
+console.log("Ola, mundo!");//Portuguese
+console.log("こんにちは世界!");//Japanese
+console.log("Selam Dünya!");//Turkish
+console.log("Hallo Wereld!");//Dutch
+console.log("Привет, мир!");//Russian
+console.log("Hallo Welt!");//German
+console.log("Salve mundi!");//Latin(!)
+
diff --git a/Week1/homework/js-exercises/logNumber.js b/Week1/homework/js-exercises/logNumber.js
new file mode 100644
index 000000000..164ebace1
--- /dev/null
+++ b/Week1/homework/js-exercises/logNumber.js
@@ -0,0 +1,7 @@
+'use strict'
+let numberX;
+console.log("undefined");
+console.log(numberX);
+numberX = 77;
+console.log("The number I assigned to the variable:");
+console.log(numberX);
\ No newline at end of file
diff --git a/Week1/homework/js-exercises/logRemainder.js b/Week1/homework/js-exercises/logRemainder.js
new file mode 100644
index 000000000..c5ffe30f6
--- /dev/null
+++ b/Week1/homework/js-exercises/logRemainder.js
@@ -0,0 +1,4 @@
+"use strict";
+//1. The answer is 1. The number 6 can be divided by 3 so the remainder after the division is 1.
+//2. The answer is 1. The number 20 can be divided by 4 so the remainder after the division is 1.
+//3. The answer is 1. The number 12 can be divided by 2 so the remainder after the division is 1.
\ No newline at end of file
diff --git a/Week1/homework/js-exercises/logString.js b/Week1/homework/js-exercises/logString.js
new file mode 100644
index 000000000..1dde91930
--- /dev/null
+++ b/Week1/homework/js-exercises/logString.js
@@ -0,0 +1,7 @@
+'use strict'
+let myString = "Stefanos Leventis";
+console.log("My full name");
+console.log(myString);
+myString = "The Arkitekt";
+console.log("My nickname as a music producer");
+console.log(myString);
\ No newline at end of file
diff --git a/Week1/homework/js-exercises/numRound.js b/Week1/homework/js-exercises/numRound.js
new file mode 100644
index 000000000..f95a9db5c
--- /dev/null
+++ b/Week1/homework/js-exercises/numRound.js
@@ -0,0 +1,7 @@
+'use strict'
+let z = 7.25;
+console.log(z);
+let a = Math.round(z);
+console.log(a);
+let x = Math.max(a, z);
+console.log(x);
\ No newline at end of file
diff --git a/Week1/homework/js-exercises/stringLength.js b/Week1/homework/js-exercises/stringLength.js
new file mode 100644
index 000000000..7f892f496
--- /dev/null
+++ b/Week1/homework/js-exercises/stringLength.js
@@ -0,0 +1,4 @@
+"use strict";
+let mySentence = "Programming is so interesting!";
+let howLongIsIt = mySentence.length;
+console.log(howLongIsIt);
\ No newline at end of file
diff --git a/Week1/homework/js-exercises/typeCheck.js b/Week1/homework/js-exercises/typeCheck.js
new file mode 100644
index 000000000..c5fca6753
--- /dev/null
+++ b/Week1/homework/js-exercises/typeCheck.js
@@ -0,0 +1,50 @@
+"use strict";
+//Declare variables
+let str1 = "Windows";
+let str2 = "Linux";
+let obj1 = { name: "Bill", surname: "Gates" };
+let obj2 = { name: "Linus", surname: "Torvalds" };
+//Check data type
+console.log(typeof str1);
+console.log(typeof obj1);
+//Conditional statements
+if (typeof (str1) == typeof (str2)) {
+ console.log("SAME");
+} else {
+ console.log("NOT THE SAME");
+}
+if (typeof (str1) == typeof (obj1)) {
+ console.log("SAME");
+} else {
+ console.log("NOT THE SAME");
+}
+if (typeof (str1) == typeof (obj2)) {
+ console.log("SAME");
+} else {
+ console.log("NOT THE SAME");
+}
+if (typeof (str2) == typeof (obj1)) {
+ console.log("SAME");
+} else {
+ console.log("NOT THE SAME");
+}
+if (typeof (str2) == typeof (obj2)) {
+ console.log("SAME");
+} else {
+ console.log("NOT THE SAME");
+}
+if (typeof (obj1) == typeof (obj2)) {
+ console.log("SAME");
+} else {
+ console.log("NOT THE SAME");
+}
+//Alternative solution
+console.log("ALTERNATIVE SOLUTION")
+function compareDate(a, b) {
+ if (typeof (a) === typeof (b)) { return "SAME" }
+ return "NOT THE SAME"
+}
+console.log(compareData(str1, str2));
+console.log(compareData(str1, obj2));
+//END OF CODE
+
diff --git a/Week1/homework/main.js b/Week1/homework/main.js
deleted file mode 100644
index e69de29bb..000000000
diff --git a/Week2/Homework/codeAlong/temperature-converter/index.html b/Week2/Homework/codeAlong/temperature-converter/index.html
new file mode 100644
index 000000000..0adfc9874
--- /dev/null
+++ b/Week2/Homework/codeAlong/temperature-converter/index.html
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+ Temperature Converter
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Week2/Homework/codeAlong/temperature-converter/script.js b/Week2/Homework/codeAlong/temperature-converter/script.js
new file mode 100644
index 000000000..1ba7834b2
--- /dev/null
+++ b/Week2/Homework/codeAlong/temperature-converter/script.js
@@ -0,0 +1,38 @@
+const celsiusInput = document.querySelector("#celsius > input");
+const fahrenheitInput = document.querySelector("#fahrenheit > input");
+const kelvinInput = document.querySelector("#kelvin > input");
+
+function roundNum(num) {
+ return Math.round(num * 100) / 100;
+}
+
+function celsiusToFahrenheitAndKelvin() {
+ const cTemp = parseFloat(celsiusInput.value);
+ const fTemp = (cTemp * (9 / 5)) + 32;
+ const kTemp = cTemp + 273.15;
+ fahrenheitInput.value = roundNum(fTemp);
+ kelvinInput.value = roundNum(kTemp);
+}
+
+function fahrenheitToCelsiusAndKelvin() {
+ const fTemp = parseFloat(fahrenheitInput.value);
+ const cTemp = (fTemp - 32) * (5 * 9);
+ const kTemp = (fTemp + 459.67) * 5 / 9
+ celsiusInput.value = roundNum(cTemp);
+ kelvinInput.value = roundNum(kTemp);
+}
+
+function kelvinToCelsiusAndFahrenheit() {
+ const kTemp = parseFloat(kelvinInput.value);
+ const cTemp = kTemp - 273.15;
+ const fTemp = 9 / 5 * (kTemp - 273) + 32;
+ celsiusInput.value = roundNum(cTemp);
+ fahrenheitInput.value = roundNum(fTemp);
+}
+
+function main() {
+ celsiusInput.addEventListener("input", celsiusToFahrenheitAndKelvin);
+ fahrenheitInput.addEventListener("input", fahrenheitToCelsiusAndKelvin);
+ kelvinInput.addEventListener("input", kelvinToCelsiusAndFahrenheit);
+}
+main();
\ No newline at end of file
diff --git a/Week2/Homework/codeAlong/temperature-converter/style.css b/Week2/Homework/codeAlong/temperature-converter/style.css
new file mode 100644
index 000000000..eca37f9c4
--- /dev/null
+++ b/Week2/Homework/codeAlong/temperature-converter/style.css
@@ -0,0 +1,62 @@
+@import url('https://fonts.googleapis.com/css?family=Source+Code+Pro&display=swap');
+
+*{
+ padding: 0;
+ margin: 0;
+ box-sizing: border-box;
+}
+body {
+ background: rgb(0, 5, 17);
+}
+div {
+ height: 33.33vh;
+}
+
+#fahrenheit {
+ border-top: 4px solid white;
+ border-bottom: 4px solid white;
+}
+
+input[type=number]{
+ width: 100%;
+ height: 100%;
+ font-family: 'Source Code Pro', monospace;
+ background: rgb(0,5,17);
+ color: white;
+ text-align: center;
+ border: 0;
+ outline: none;
+}
+::placeholder {
+ color: #2d353b;
+}
+
+@media (max-width: 576px) {
+ input[type=number]{
+ font-size:3.5em;}
+}
+
+@media (min-width: 576px) {
+ input[type=number]{
+ font-size:4em;}
+}
+
+
+
+@media (min-width: 768px) {
+ input[type=number]{
+ font-size:6em;}
+}
+
+
+@media (min-width: 992px) {
+ input[type=number]{
+ font-size:8em;}
+}
+
+
+
+@media (min-width: 1200px) {
+ input[type=number]{
+ font-size:10em;}
+}
\ No newline at end of file
diff --git a/Week2/Homework/codeAlong/weight-converter/index.html b/Week2/Homework/codeAlong/weight-converter/index.html
new file mode 100644
index 000000000..133e3913a
--- /dev/null
+++ b/Week2/Homework/codeAlong/weight-converter/index.html
@@ -0,0 +1,68 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ Weight Converter
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Week2/Homework/codeAlong/weight-converter/script.js b/Week2/Homework/codeAlong/weight-converter/script.js
new file mode 100644
index 000000000..71b62843e
--- /dev/null
+++ b/Week2/Homework/codeAlong/weight-converter/script.js
@@ -0,0 +1,10 @@
+document.querySelector("#output").style.visibility = "hidden";
+let input = document.querySelector("#lbsInput")
+input.addEventListener("input", (e => {
+ document.querySelector("#output").style.visibility = "visible";
+ let lbs = e.target.value;
+ document.querySelector("#gramsOutput").innerHTML = (lbs / 0.0022046).toFixed(2);
+ document.querySelector("#kgOutput").innerHTML = (lbs / 2.2046).toFixed(2);
+ document.querySelector("#ozOutput").innerHTML = (lbs * 16).toFixed(2);
+
+}));
\ No newline at end of file
diff --git a/Week2/Homework/codeAlong/weight-converter/style.css b/Week2/Homework/codeAlong/weight-converter/style.css
new file mode 100644
index 000000000..a420013bd
--- /dev/null
+++ b/Week2/Homework/codeAlong/weight-converter/style.css
@@ -0,0 +1,43 @@
+
+@import url('https://fonts.googleapis.com/css?family=Raleway&display=swap');
+
+*{
+margin:0px;
+padding: 0px;
+}
+
+body {
+ margin-top: 70px;
+ background:rgb(36, 64, 100);
+ color: #fff;
+ font-size: 0.5rem!important;
+ font-family: 'Raleway', sans-serif;
+}
+#gramsOutput,#kgOutput,#ozOutput{
+ font-size: 1.2rem!important;
+}
+
+@media (max-width: 576px) {
+ h1 {font-size: 1.8rem!important;}
+ h4 {font-size: 1rem!important;}
+ input {font-size: 1rem!important;}
+ }
+
+@media (min-width: 576px) {
+ h1 {font-size: 2rem!important;}
+ h4 {font-size: 1.2rem!important;}
+ input {font-size: 1.2rem!important;}
+ }
+
+@media (min-width: 768px) {
+ h1 {font-size: 3.5rem!important;}
+ h4 {font-size: 1.5rem!important;}
+ input {font-size: 1.5rem!important;}
+ }
+
+@media (min-width: 992px) {
+ h1 {font-size: 3.8rem!important;}
+ h4 {font-size: 1.5rem!important;}
+ input {font-size: 1.5rem!important;}
+ }
+
diff --git a/Week2/Homework/js-exercises/even-oddReporter.js b/Week2/Homework/js-exercises/even-oddReporter.js
new file mode 100644
index 000000000..2a6ef3efc
--- /dev/null
+++ b/Week2/Homework/js-exercises/even-oddReporter.js
@@ -0,0 +1,10 @@
+"use strict"
+for (let i = 0; i <= 20; i++) {
+ if (i % 2 === 0) {
+ console.log(`The number ${i} is even!`)
+ } else {
+ console.log(`The number ${i} is odd!`)
+ }
+}
+
+
diff --git a/Week2/Homework/js-exercises/readingList.js b/Week2/Homework/js-exercises/readingList.js
new file mode 100644
index 000000000..36a4becf1
--- /dev/null
+++ b/Week2/Homework/js-exercises/readingList.js
@@ -0,0 +1,30 @@
+"use strict"
+//Variable declaration
+let readList = [
+ {
+ title: "The 7 habits of highly effective people",
+ author: "Stephen R. Covey",
+ alreadyRead: false
+ }, {
+ title: "The Lean Startup",
+ author: "Eric Ries",
+ alreadyRead: true
+ }, {
+ title: "Neuro-linguistic Programming for Dummies",
+ author: "Kate Burton",
+ alreadyRead: true
+ }
+];
+//Just looping through the array
+readList.forEach(x => {
+ console.log(x);
+})
+//Console logging each book title and author
+readList.forEach(x => {
+ console.log(`${x.title} by ${x.author}`);
+
+})
+//Conditional statements
+readList.forEach(x => {
+ console.log(x.alreadyRead === true ? `You already read "${x.title}"` : `You still need to read "${x.title}"`)
+})
\ No newline at end of file
diff --git a/Week2/Homework/js-exercises/recipeCard.js b/Week2/Homework/js-exercises/recipeCard.js
new file mode 100644
index 000000000..c77a62084
--- /dev/null
+++ b/Week2/Homework/js-exercises/recipeCard.js
@@ -0,0 +1,29 @@
+"use strict"
+
+//Variable declaration.
+const myRecipe02 = {
+ title: "Pizza",
+ servings: "1",
+ ingredients: [
+ "flour", "milk", "tomato", "cheese", "peperoni", "bacon", "mushroom",
+ ]
+}
+//Loop that iterates through the object.
+for (let key in myRecipe02) {
+ //If statements logging the value of each key.
+ if (myRecipe02[key] === myRecipe02["title"]) {
+ console.log(`Meal name: ${myRecipe02[key]}`);
+ }
+ else if (myRecipe02[key] === myRecipe02["servings"]) {
+ console.log(`Serves: ${myRecipe02[key]}`);
+ }
+ else {
+ console.log(`Ingredients: `);
+ for (let i = 0; i < myRecipe02.ingredients.length; i++) {
+ console.log(myRecipe02[key][i]);
+ }
+ }
+
+}
+
+
diff --git a/Week2/Homework/js-exercises/removeComma.js b/Week2/Homework/js-exercises/removeComma.js
new file mode 100644
index 000000000..fca34e9ba
--- /dev/null
+++ b/Week2/Homework/js-exercises/removeComma.js
@@ -0,0 +1,5 @@
+"use strict"
+let myString = "hello,this,is,a,difficult,to,read,sentence";
+console.log(myString.length);
+myString = myString.split(",").join(" ");
+console.log(myString);
\ No newline at end of file
diff --git a/Week2/Homework/js-exercises/whoWantsADrink.js b/Week2/Homework/js-exercises/whoWantsADrink.js
new file mode 100644
index 000000000..01af82ffa
--- /dev/null
+++ b/Week2/Homework/js-exercises/whoWantsADrink.js
@@ -0,0 +1,18 @@
+//Variables
+const drinkTypes = ["cola", "lemonade", "water"];
+let drinkTray = [];
+let index = 0;
+//Function to check if the drink is repeated
+function isRepeated(drink) {
+ return drink === drinkTypes[index]
+}
+//Loop iterating through the array
+for (let i = 0; i < 5; i++) {
+ drinkTray.push(drinkTypes[index]);
+ if (drinkTray.filter(isRepeated).length === 2) {
+ index += 1;
+ }
+}
+//Final console.log
+console.log(`Hey guys, I brought a ${drinkTray.join(", ")}!`);
+
diff --git a/Week2/Homework/project-gradeCalculator/gradeCalculator.js b/Week2/Homework/project-gradeCalculator/gradeCalculator.js
new file mode 100644
index 000000000..a500e7627
--- /dev/null
+++ b/Week2/Homework/project-gradeCalculator/gradeCalculator.js
@@ -0,0 +1,39 @@
+"use strict"
+//Creating a function with two arguments, "score" and "total".
+//e.g. if you got 16 out of 20, score=16, total=20
+function yourGrade(score, total) {
+ //Converting score into a percentage
+ let percent = (Math.floor((score / total) * 100));
+ //Declaring the variable for the grade
+ let grade;
+ //If statements for each score range returning the appropriate phrase
+ if (percent <= 100 && percent >= 90) {
+ grade = "A";
+ return `You got a ${grade} (${percent}%)!`
+ }
+ else if (percent <= 89 && percent >= 80) {
+ grade = "B";
+ return `You got a ${grade} (${percent}%)!`
+ }
+ else if (percent <= 79 && percent >= 70) {
+ grade = "C";
+ return `You got a ${grade} (${percent}%)!`
+ }
+ else if (percent <= 69 && percent >= 60) {
+ grade = "D";
+ return `You got a ${grade} (${percent}%)!`
+ }
+ else if (percent <= 59 && percent >= 50) {
+ grade = "E";
+ return `You got a ${grade} (${percent}%)!`
+ }
+ else {
+ grade = "F";
+ return `You got a ${grade} (${percent}%)!`
+ }
+
+}
+//Testing if the function works with console.log
+console.log(yourGrade(16, 20));
+console.log(yourGrade(7, 10));
+console.log(yourGrade(9, 50));
\ No newline at end of file
diff --git a/Week3/Homework/codeAlong/meditation-app/README.md b/Week3/Homework/codeAlong/meditation-app/README.md
new file mode 100644
index 000000000..4fe1244fd
--- /dev/null
+++ b/Week3/Homework/codeAlong/meditation-app/README.md
@@ -0,0 +1,2 @@
+# meditation-app
+Meditation app tutorial
diff --git a/Week3/Homework/codeAlong/meditation-app/app.js b/Week3/Homework/codeAlong/meditation-app/app.js
new file mode 100644
index 000000000..b59178a23
--- /dev/null
+++ b/Week3/Homework/codeAlong/meditation-app/app.js
@@ -0,0 +1,80 @@
+const song = document.querySelector(".song");
+const play = document.querySelector(".play");
+const replay = document.querySelector(".replay");
+const outline = document.querySelector(".moving-outline circle");
+const video = document.querySelector(".vid-container video");
+//Sounds
+const sounds = document.querySelectorAll(".sound-picker button");
+//Time Display
+const timeDisplay = document.querySelector(".time-display");
+const outlineLength = outline.getTotalLength();
+//Duration
+const timeSelect = document.querySelectorAll(".time-select button");
+let fakeDuration = 600;
+
+outline.style.strokeDashoffset = outlineLength;
+outline.style.strokeDasharray = outlineLength;
+timeDisplay.textContent = `${Math.floor(fakeDuration / 60)}:${Math.floor(
+ fakeDuration % 60
+)}`;
+
+sounds.forEach(sound => {
+ sound.addEventListener("click", function () {
+ song.src = this.getAttribute("data-sound");
+ video.src = this.getAttribute("data-video");
+ checkPlaying(song);
+ });
+});
+
+play.addEventListener("click", function () {
+ checkPlaying(song);
+});
+
+replay.addEventListener("click", function () {
+ restartSong(song);
+
+});
+
+
+const restartSong = song => {
+ let currentTime = song.currentTime;
+ song.currentTime = 0;
+}
+
+timeSelect.forEach(option => {
+ option.addEventListener("click", function () {
+ fakeDuration = this.getAttribute("data-time");
+ timeDisplay.textContent = `${Math.floor(fakeDuration / 60)}:${Math.floor(
+ fakeDuration % 60
+ )}`;
+ });
+});
+
+const checkPlaying = song => {
+ if (song.paused) {
+ song.play();
+ video.play();
+ play.src = "./svg/pause.svg";
+ } else {
+ song.pause();
+ video.pause();
+ play.src = "./svg/play.svg";
+ }
+};
+
+song.ontimeupdate = function () {
+ let currentTime = song.currentTime;
+ let elapsed = fakeDuration - currentTime;
+ let seconds = Math.floor(elapsed % 60);
+ let minutes = Math.floor(elapsed / 60);
+ timeDisplay.textContent = `${minutes}:${seconds}`;
+ let progress = outlineLength - (currentTime / fakeDuration) * outlineLength;
+ outline.style.strokeDashoffset = progress;
+
+ if (currentTime >= fakeDuration) {
+ song.pause();
+ song.currentTime = 0;
+ play.src = "./svg/play.svg";
+ video.pause();
+ }
+};
\ No newline at end of file
diff --git a/Week3/Homework/codeAlong/meditation-app/index.html b/Week3/Homework/codeAlong/meditation-app/index.html
new file mode 100644
index 000000000..12e0a1cf6
--- /dev/null
+++ b/Week3/Homework/codeAlong/meditation-app/index.html
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+ Meditation App
+
+
+
+
+
+
+
+
+
+
+ 10 seconds
+ 5 minutes
+ 10 minutes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
0:00
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Week3/Homework/codeAlong/meditation-app/sounds/beach.mp3 b/Week3/Homework/codeAlong/meditation-app/sounds/beach.mp3
new file mode 100644
index 000000000..dadf37e0e
Binary files /dev/null and b/Week3/Homework/codeAlong/meditation-app/sounds/beach.mp3 differ
diff --git a/Week3/Homework/codeAlong/meditation-app/sounds/rain.mp3 b/Week3/Homework/codeAlong/meditation-app/sounds/rain.mp3
new file mode 100644
index 000000000..e8425fcc6
Binary files /dev/null and b/Week3/Homework/codeAlong/meditation-app/sounds/rain.mp3 differ
diff --git a/Week3/Homework/codeAlong/meditation-app/style.css b/Week3/Homework/codeAlong/meditation-app/style.css
new file mode 100644
index 000000000..df7f0111b
--- /dev/null
+++ b/Week3/Homework/codeAlong/meditation-app/style.css
@@ -0,0 +1,111 @@
+@import url('https://fonts.googleapis.com/css?family=Sawarabi+Mincho&display=swap');
+* {
+ margin: 0;
+ padding: 0;
+ box-sizing: border-box;
+ font-family: 'Sawarabi Mincho', sans-serif;
+}
+
+.app {
+ height: 100vh;
+ display: flex;
+ justify-content: space-evenly;
+ align-items: center;
+ font-family: "Montserrat", sans-serif;
+}
+
+.time-select,
+.sound-picker {
+ height: 80%;
+ display: flex;
+ justify-content: space-evenly;
+ align-items: center;
+ flex-direction: column;
+ flex: 1;
+}
+.time-select button,
+.sound-picker button {
+ color: white;
+ width: 30%;
+ height: 10%;
+ background: none;
+ font-size: 20px;
+ border-radius: 5px;
+ cursor: pointer;
+ border: 2px solid white;
+ transition: all 0.5s ease;
+}
+
+.sound-picker button {
+ border: none;
+ height: 120px;
+ width: 120px;
+ padding: 30px;
+ border-radius: 50%;
+}
+.sound-picker button:nth-child(1) {
+ background: #047579;
+}
+.sound-picker button:nth-child(2) {
+ background: #fc6b31;
+}
+.sound-picker button img {
+ height: 100%;
+}
+
+.time-select button:hover {
+ background: white;
+ color: black;
+}
+
+.player-container {
+ position: relative;
+ height: 80%;
+ display: flex;
+ justify-content: space-evenly;
+ align-items: center;
+ flex-direction: column;
+ flex: 1;
+}
+
+.player-container svg {
+ position: absolute;
+ height: 50%;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%) rotate(-90deg);
+ pointer-events: none;
+}
+.player-container svg circle {
+ transition: all 0.2s ease-in-out;
+}
+.time-display {
+ color: white;
+ position: absolute;
+ font-size: 50px;
+ bottom: 10%;
+}
+
+video {
+ position: fixed;
+ top: 0%;
+ left: 0%;
+ width: 100vw;
+ z-index: -10;
+}
+img.play {
+ height: 160px;
+ position: absolute;
+}
+img.replay {
+ position:absolute;
+ top:62vh;
+}
+video {
+ height: 100vh;
+ width: 100vw;
+}
+body {
+ background-color: black;
+}
+
diff --git a/Week3/Homework/codeAlong/meditation-app/svg/beach.svg b/Week3/Homework/codeAlong/meditation-app/svg/beach.svg
new file mode 100644
index 000000000..48ba1b9e7
--- /dev/null
+++ b/Week3/Homework/codeAlong/meditation-app/svg/beach.svg
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/Week3/Homework/codeAlong/meditation-app/svg/moving-outline.svg b/Week3/Homework/codeAlong/meditation-app/svg/moving-outline.svg
new file mode 100644
index 000000000..3e75b2c41
--- /dev/null
+++ b/Week3/Homework/codeAlong/meditation-app/svg/moving-outline.svg
@@ -0,0 +1,3 @@
+
+
+
diff --git a/Week3/Homework/codeAlong/meditation-app/svg/pause.svg b/Week3/Homework/codeAlong/meditation-app/svg/pause.svg
new file mode 100644
index 000000000..b950b26bc
--- /dev/null
+++ b/Week3/Homework/codeAlong/meditation-app/svg/pause.svg
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/Week3/Homework/codeAlong/meditation-app/svg/play.svg b/Week3/Homework/codeAlong/meditation-app/svg/play.svg
new file mode 100644
index 000000000..781afc842
--- /dev/null
+++ b/Week3/Homework/codeAlong/meditation-app/svg/play.svg
@@ -0,0 +1,3 @@
+
+
+
diff --git a/Week3/Homework/codeAlong/meditation-app/svg/rain.svg b/Week3/Homework/codeAlong/meditation-app/svg/rain.svg
new file mode 100644
index 000000000..0a56c9885
--- /dev/null
+++ b/Week3/Homework/codeAlong/meditation-app/svg/rain.svg
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/Week3/Homework/codeAlong/meditation-app/svg/replay.svg b/Week3/Homework/codeAlong/meditation-app/svg/replay.svg
new file mode 100644
index 000000000..91bb750a1
--- /dev/null
+++ b/Week3/Homework/codeAlong/meditation-app/svg/replay.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/Week3/Homework/codeAlong/meditation-app/svg/track-outline.svg b/Week3/Homework/codeAlong/meditation-app/svg/track-outline.svg
new file mode 100644
index 000000000..e2efc9b3e
--- /dev/null
+++ b/Week3/Homework/codeAlong/meditation-app/svg/track-outline.svg
@@ -0,0 +1,3 @@
+
+
+
diff --git a/Week3/Homework/codeAlong/meditation-app/video/beach.mp4 b/Week3/Homework/codeAlong/meditation-app/video/beach.mp4
new file mode 100644
index 000000000..d7c20b5fb
Binary files /dev/null and b/Week3/Homework/codeAlong/meditation-app/video/beach.mp4 differ
diff --git a/Week3/Homework/codeAlong/meditation-app/video/rain.mp4 b/Week3/Homework/codeAlong/meditation-app/video/rain.mp4
new file mode 100644
index 000000000..cc0a6d0c5
Binary files /dev/null and b/Week3/Homework/codeAlong/meditation-app/video/rain.mp4 differ
diff --git a/Week3/Homework/js-exercises/dogYears.js b/Week3/Homework/js-exercises/dogYears.js
new file mode 100644
index 000000000..0e9d3e29d
--- /dev/null
+++ b/Week3/Homework/js-exercises/dogYears.js
@@ -0,0 +1,7 @@
+"use strict"
+function calculateDogAge(age) {
+ let dogYears = age * 7;
+ return `Your doggie is ${dogYears} years old in dog years!`
+};
+//Test
+calculateDogAge(14);
\ No newline at end of file
diff --git a/Week3/Homework/js-exercises/fortuneTeller.js b/Week3/Homework/js-exercises/fortuneTeller.js
new file mode 100644
index 000000000..5a55fffb8
--- /dev/null
+++ b/Week3/Homework/js-exercises/fortuneTeller.js
@@ -0,0 +1,16 @@
+"use strict"
+function tellFortune() {
+ let numChildren = [2, 3, 4, 5, 6];
+ let partnerNames = ["Anna", "Johanna", "Barbara", "Jennifer", "Nicole"];
+ let locations = ["Athens", "Barcelona", "Rome", "New York", "London"];
+ let jobs = ["developer", "music producer", "lawyer", "comedian", "doctor"];
+
+ let randChild = numChildren[Math.floor(Math.random() * numChildren.length)];
+ let randPartn = partnerNames[Math.floor(Math.random() * partnerNames.length)];
+ let randLoc = locations[Math.floor(Math.random() * locations.length)];
+ let randJob = jobs[Math.floor(Math.random() * jobs.length)];
+
+ return `You will be a ${randJob} in ${randLoc}, and married to ${randPartn} with ${randChild} kids.`
+}
+//Test
+tellFortune();
diff --git a/Week3/Homework/js-exercises/shopping.js b/Week3/Homework/js-exercises/shopping.js
new file mode 100644
index 000000000..443b022ea
--- /dev/null
+++ b/Week3/Homework/js-exercises/shopping.js
@@ -0,0 +1,13 @@
+"use strict"
+function addToShoppingCart(item) {
+ shopList.push(item);
+ if (shopList.length > 3) {
+ shopList.shift();
+ }
+ return `You bought ${shopList.join(", ")}`;
+}
+let shopList = ["bananas", "milk"];
+
+console.log(addToShoppingCart("eggs"));
+console.log(addToShoppingCart("bread"));
+console.log(addToShoppingCart("lettuce"));
diff --git a/Week3/Homework/js-exercises/totalCost.js b/Week3/Homework/js-exercises/totalCost.js
new file mode 100644
index 000000000..d6f883530
--- /dev/null
+++ b/Week3/Homework/js-exercises/totalCost.js
@@ -0,0 +1,19 @@
+"use strict"
+//Function declaration
+function calculateTotalPrice(allItems) {
+ let total = 0;
+ for (let item in allItems) {
+ total += allItems[item];
+ }
+ return `The total price of your items is $${total.toFixed(2)}.`;
+}
+//Object with items in cart
+let cartForParty = {
+ beers: 4.92,
+ chips: 1.78,
+ popcorn: 2.19,
+ whiskey: 10.77,
+ cola: 3.23
+}
+//Calling the function
+calculateTotalPrice(cartForParty);
diff --git a/Week3/Homework/js-exercises/youAreAmazing.js b/Week3/Homework/js-exercises/youAreAmazing.js
new file mode 100644
index 000000000..db89ff652
--- /dev/null
+++ b/Week3/Homework/js-exercises/youAreAmazing.js
@@ -0,0 +1,8 @@
+"use strict"
+function giveCompliment(name) {
+ let compliments = ["great", "awesome", "a genius", "brilliant", "simply the best", "irresistibly charming", "so patient", "so smart", "absolutely fantastic", "a rock star"];
+
+ let selectRandom = compliments[Math.floor(Math.random() * compliments.length)];
+ return `You are ${selectRandom}, ${name}!`;
+
+}
\ No newline at end of file
diff --git a/Week3/Homework/project-creditCardValidator/creditCardValidator.js b/Week3/Homework/project-creditCardValidator/creditCardValidator.js
new file mode 100644
index 000000000..48a14ec79
--- /dev/null
+++ b/Week3/Homework/project-creditCardValidator/creditCardValidator.js
@@ -0,0 +1,49 @@
+"use strict"
+
+function creditCardValidator(num) {
+ //Variables declaration. numToString variable turns number into string
+ let numToString = num.toString();
+ let valid = "is a valid number!"
+ let invalid = "is an invalid number."
+
+ //If statements for each rule:
+
+ //Number must contain 16 digits
+ if (numToString.length > 16 || numToString.length < 16) {
+ return `${num} ${invalid} Number must be 16 digits long`;
+ //Number must only numbers not other characters
+ } else if (isNaN(parseInt(numToString))) {
+ return `${num} ${invalid} Number contains invalid characters`;
+ //All digits cannot be the same
+ } else if (allEqual(numToString) === true) {
+ return `${num} ${invalid} All of the digits cannot be the same`;
+ //Last digit must be an even number
+ } else if (parseInt(numToString.slice(-1)) % 2 !== 0) {
+ return `${num} ${invalid} Last digit must be even`;
+ //The sum of all the digits must be greater than 16
+ } else if (addDigits(numToString) < 16) {
+ return `${num} ${invalid} The sum of all the digits must be greater than 16`;
+ //Message when number is valid
+ } else { return `${num} ${valid}` }
+
+ //Functions
+
+ //Adds the digits of the number one by one
+ function addDigits(val) {
+ let sum = 0;
+ for (let i = 0; i < val.length; i++) {
+ sum += parseInt(val[i]);
+ }
+ return sum;
+ }
+
+ //Checks if all digits are equal
+ function allEqual(val) {
+ let result;
+ for (i = 0; i < val.length; i++) {
+ result = val[0] === val[i];
+ }
+ return result;
+ }
+}
+