-
-
-
-
diff --git a/01-Fundamentals-Part-1/final/script.js b/01-Fundamentals-Part-1/final/script.js
deleted file mode 100644
index c966226c88..0000000000
--- a/01-Fundamentals-Part-1/final/script.js
+++ /dev/null
@@ -1,468 +0,0 @@
-/*
-////////////////////////////////////
-// Linking a JavaScript File
-let js = "amazing";
-console.log(40 + 8 + 23 - 10);
-
-////////////////////////////////////
-// Values and Variables
-console.log("Jonas");
-console.log(23);
-
-let firstName = "Matilda";
-
-console.log(firstName);
-console.log(firstName);
-console.log(firstName);
-
-// Variable name conventions
-let jonas_matilda = "JM";
-let $function = 27;
-
-let person = "jonas";
-let PI = 3.1415;
-
-let myFirstJob = "Coder";
-let myCurrentJob = "Teacher";
-
-let job1 = "programmer";
-let job2 = "teacher";
-
-console.log(myFirstJob);
-
-////////////////////////////////////
-// Data Types
-let javascriptIsFun = true;
-console.log(javascriptIsFun);
-
-// console.log(typeof true);
-console.log(typeof javascriptIsFun);
-// console.log(typeof 23);
-// console.log(typeof 'Jonas');
-
-javascriptIsFun = 'YES!';
-console.log(typeof javascriptIsFun);
-
-let year;
-console.log(year);
-console.log(typeof year);
-
-year = 1991;
-console.log(typeof year);
-
-console.log(typeof null);
-
-////////////////////////////////////
-// let, const and var
-let age = 30;
-age = 31;
-
-const birthYear = 1991;
-// birthYear = 1990;
-// const job;
-
-var job = 'programmer';
-job = 'teacher'
-
-lastName = 'Schmedtmann';
-console.log(lastName);
-
-////////////////////////////////////
-// Basic Operators
-// Math operators
-const now = 2037;
-const ageJonas = now - 1991;
-const ageSarah = now - 2018;
-console.log(ageJonas, ageSarah);
-
-console.log(ageJonas * 2, ageJonas / 10, 2 ** 3);
-// 2 ** 3 means 2 to the power of 3 = 2 * 2 * 2
-
-const firstName = 'Jonas';
-const lastName = 'Schmedtmann';
-console.log(firstName + ' ' + lastName);
-
-// Assignment operators
-let x = 10 + 5; // 15
-x += 10; // x = x + 10 = 25
-x *= 4; // x = x * 4 = 100
-x++; // x = x + 1
-x--;
-x--;
-console.log(x);
-
-// Comparison operators
-console.log(ageJonas > ageSarah); // >, <, >=, <=
-console.log(ageSarah >= 18);
-
-const isFullAge = ageSarah >= 18;
-
-console.log(now - 1991 > now - 2018);
-
-////////////////////////////////////
-// Operator Precedence
-const now = 2037;
-const ageJonas = now - 1991;
-const ageSarah = now - 2018;
-
-console.log(now - 1991 > now - 2018);
-
-let x, y;
-x = y = 25 - 10 - 5; // x = y = 10, x = 10
-console.log(x, y);
-
-const averageAge = (ageJonas + ageSarah) / 2;
-console.log(ageJonas, ageSarah, averageAge);
-*/
-
-////////////////////////////////////
-// Coding Challenge #1
-
-/*
-Mark and John are trying to compare their BMI (Body Mass Index), which is calculated using the formula: BMI = mass / height ** 2 = mass / (height * height). (mass in kg and height in meter).
-
-1. Store Mark's and John's mass and height in variables
-2. Calculate both their BMIs using the formula (you can even implement both versions)
-3. Create a boolean variable 'markHigherBMI' containing information about whether Mark has a higher BMI than John.
-
-TEST DATA 1: Marks weights 78 kg and is 1.69 m tall. John weights 92 kg and is 1.95 m tall.
-TEST DATA 2: Marks weights 95 kg and is 1.88 m tall. John weights 85 kg and is 1.76 m tall.
-
-GOOD LUCK π
-*/
-
-// const massMark = 78;
-// const heightMark = 1.69;
-// const massJohn = 92;
-// const heightJohn = 1.95;
-
-/*
-const massMark = 95;
-const heightMark = 1.88;
-const massJohn = 85;
-const heightJohn = 1.76;
-
-const BMIMark = massMark / heightMark ** 2;
-const BMIJohn = massJohn / (heightJohn * heightJohn);
-const markHigherBMI = BMIMark > BMIJohn;
-
-console.log(BMIMark, BMIJohn, markHigherBMI);
-
-////////////////////////////////////
-// Strings and Template Literals
-const firstName = 'Jonas';
-const job = 'teacher';
-const birthYear = 1991;
-const year = 2037;
-
-const jonas = "I'm " + firstName + ', a ' + (year - birthYear) + ' year old ' + job + '!';
-console.log(jonas);
-
-const jonasNew = `I'm ${firstName}, a ${year - birthYear} year old ${job}!`;
-console.log(jonasNew);
-
-console.log(`Just a regular string...`);
-
-console.log('String with \n\
-multiple \n\
-lines');
-
-console.log(`String
-multiple
-lines`);
-
-
-////////////////////////////////////
-// Taking Decisions: if / else Statements
-const age = 15;
-
-if (age >= 18) {
- console.log('Sarah can start driving license π');
-} else {
- const yearsLeft = 18 - age;
- console.log(`Sarah is too young. Wait another ${yearsLeft} years :)`);
-}
-
-const birthYear = 2012;
-
-let century;
-if (birthYear <= 2000) {
- century = 20;
-} else {
- century = 21;
-}
-console.log(century);
-*/
-
-////////////////////////////////////
-// Coding Challenge #2
-
-/*
-Use the BMI example from Challenge #1, and the code you already wrote, and improve it:
-
-1. Print a nice output to the console, saying who has the higher BMI. The message can be either "Mark's BMI is higher than John's!" or "John's BMI is higher than Mark's!"
-2. Use a template literal to include the BMI values in the outputs. Example: "Mark's BMI (28.3) is higher than John's (23.9)!"
-
-HINT: Use an if/else statement π
-
-GOOD LUCK π
-*/
-
-/*
-const massMark = 78;
-const heightMark = 1.69;
-const massJohn = 92;
-const heightJohn = 1.95;
-
-// const massMark = 95;
-// const heightMark = 1.88;
-// const massJohn = 85;
-// const heightJohn = 1.76;
-
-const BMIMark = massMark / heightMark ** 2;
-const BMIJohn = massJohn / (heightJohn * heightJohn);
-console.log(BMIMark, BMIJohn);
-
-if (BMIMark > BMIJohn) {
- console.log(`Mark's BMI (${BMIMark}) is higher than John's (${BMIJohn})!`)
-} else {
- console.log(`John's BMI (${BMIJohn}) is higher than Marks's (${BMIMark})!`)
-}
-
-////////////////////////////////////
-// Type Conversion and Coercion
-
-// type conversion
-const inputYear = '1991';
-console.log(Number(inputYear), inputYear);
-console.log(Number(inputYear) + 18);
-
-console.log(Number('Jonas'));
-console.log(typeof NaN);
-
-console.log(String(23), 23);
-
-// type coercion
-console.log('I am ' + 23 + ' years old');
-console.log('23' - '10' - 3);
-console.log('23' / '2');
-
-let n = '1' + 1; // '11'
-n = n - 1;
-console.log(n);
-
-////////////////////////////////////
-// Truthy and Falsy Values
-
-// 5 falsy values: 0, '', undefined, null, NaN
-console.log(Boolean(0));
-console.log(Boolean(undefined));
-console.log(Boolean('Jonas'));
-console.log(Boolean({}));
-console.log(Boolean(''));
-
-const money = 100;
-if (money) {
- console.log("Don't spend it all ;)");
-} else {
- console.log('You should get a job!');
-}
-
-let height = 0;
-if (height) {
- console.log('YAY! Height is defined');
-} else {
- console.log('Height is UNDEFINED');
-}
-
-////////////////////////////////////
-// Equality Operators: == vs. ===
-const age = '18';
-if (age === 18) console.log('You just became an adult :D (strict)');
-
-if (age == 18) console.log('You just became an adult :D (loose)');
-
-const favourite = Number(prompt("What's your favourite number?"));
-console.log(favourite);
-console.log(typeof favourite);
-
-if (favourite === 23) { // 22 === 23 -> FALSE
- console.log('Cool! 23 is an amzaing number!')
-} else if (favourite === 7) {
- console.log('7 is also a cool number')
-} else if (favourite === 9) {
- console.log('9 is also a cool number')
-} else {
- console.log('Number is not 23 or 7 or 9')
-}
-
-if (favourite !== 23) console.log('Why not 23?');
-
-////////////////////////////////////
-// Logical Operators
-const hasDriversLicense = true; // A
-const hasGoodVision = true; // B
-
-console.log(hasDriversLicense && hasGoodVision);
-console.log(hasDriversLicense || hasGoodVision);
-console.log(!hasDriversLicense);
-
-// if (hasDriversLicense && hasGoodVision) {
-// console.log('Sarah is able to drive!');
-// } else {
-// console.log('Someone else should drive...');
-// }
-
-const isTired = false; // C
-console.log(hasDriversLicense && hasGoodVision && isTired);
-
-if (hasDriversLicense && hasGoodVision && !isTired) {
- console.log('Sarah is able to drive!');
-} else {
- console.log('Someone else should drive...');
-}
-*/
-
-////////////////////////////////////
-// Coding Challenge #3
-
-/*
-There are two gymnastics teams, Dolphins and Koalas. They compete against each other 3 times. The winner with the highest average score wins the a trophy!
-
-1. Calculate the average score for each team, using the test data below
-2. Compare the team's average scores to determine the winner of the competition, and print it to the console. Don't forget that there can be a draw, so test for that as well (draw means they have the same average score).
-
-3. BONUS 1: Include a requirement for a minimum score of 100. With this rule, a team only wins if it has a higher score than the other team, and the same time a score of at least 100 points. HINT: Use a logical operator to test for minimum score, as well as multiple else-if blocks π
-4. BONUS 2: Minimum score also applies to a draw! So a draw only happens when both teams have the same score and both have a score greater or equal 100 points. Otherwise, no team wins the trophy.
-
-TEST DATA: Dolphins score 96, 108 and 89. Koalas score 88, 91 and 110
-TEST DATA BONUS 1: Dolphins score 97, 112 and 101. Koalas score 109, 95 and 123
-TEST DATA BONUS 2: Dolphins score 97, 112 and 101. Koalas score 109, 95 and 106
-
-GOOD LUCK π
-*/
-
-/*
-// const scoreDolphins = (96 + 108 + 89) / 3;
-// const scoreKoalas = (88 + 91 + 110) / 3;
-// console.log(scoreDolphins, scoreKoalas);
-
-// if (scoreDolphins > scoreKoalas) {
-// console.log('Dolphins win the trophy π');
-// } else if (scoreKoalas > scoreDolphins) {
-// console.log('Koalas win the trophy π');
-// } else if (scoreDolphins === scoreKoalas) {
-// console.log('Both win the trophy!');
-// }
-
-// BONUS 1
-const scoreDolphins = (97 + 112 + 80) / 3;
-const scoreKoalas = (109 + 95 + 50) / 3;
-console.log(scoreDolphins, scoreKoalas);
-
-if (scoreDolphins > scoreKoalas && scoreDolphins >= 100) {
- console.log('Dolphins win the trophy π');
-} else if (scoreKoalas > scoreDolphins && scoreKoalas >= 100) {
- console.log('Koalas win the trophy π');
-} else if (scoreDolphins === scoreKoalas && scoreDolphins >= 100 && scoreKoalas >= 100) {
- console.log('Both win the trophy!');
-} else {
- console.log('No one wins the trophy π');
-}
-
-////////////////////////////////////
-// The switch Statement
-const day = 'friday';
-
-switch (day) {
- case 'monday': // day === 'monday'
- console.log('Plan course structure');
- console.log('Go to coding meetup');
- break;
- case 'tuesday':
- console.log('Prepare theory videos');
- break;
- case 'wednesday':
- case 'thursday':
- console.log('Write code examples');
- break;
- case 'friday':
- console.log('Record videos');
- break;
- case 'saturday':
- case 'sunday':
- console.log('Enjoy the weekend :D');
- break;
- default:
- console.log('Not a valid day!');
-}
-
-if (day === 'monday') {
- console.log('Plan course structure');
- console.log('Go to coding meetup');
-} else if (day === 'tuesday') {
- console.log('Prepare theory videos');
-} else if (day === 'wednesday' || day === 'thursday') {
- console.log('Write code examples');
-} else if (day === 'friday') {
- console.log('Record videos');
-} else if (day === 'saturday' || day === 'sunday') {
- console.log('Enjoy the weekend :D');
-} else {
- console.log('Not a valid day!');
-}
-
-////////////////////////////////////
-// Statements and Expressions
-3 + 4
-1991
-true && false && !false
-
-if (23 > 10) {
- const str = '23 is bigger';
-}
-
-const me = 'Jonas';
-console.log(`I'm ${2037 - 1991} years old ${me}`);
-
-////////////////////////////////////
-// The Conditional (Ternary) Operator
-const age = 23;
-// age >= 18 ? console.log('I like to drink wine π·') : console.log('I like to drink water π§');
-
-const drink = age >= 18 ? 'wine π·' : 'water π§';
-console.log(drink);
-
-let drink2;
-if (age >= 18) {
- drink2 = 'wine π·';
-} else {
- drink2 = 'water π§';
-}
-console.log(drink2);
-
-console.log(`I like to drink ${age >= 18 ? 'wine π·' : 'water π§'}`);
-*/
-
-////////////////////////////////////
-// Coding Challenge #4
-
-/*
-Steven wants to build a very simple tip calculator for whenever he goes eating in a resturant. In his country, it's usual to tip 15% if the bill value is between 50 and 300. If the value is different, the tip is 20%.
-
-1. Your task is to caluclate the tip, depending on the bill value. Create a variable called 'tip' for this. It's not allowed to use an if/else statement π (If it's easier for you, you can start with an if/else statement, and then try to convert it to a ternary operator!)
-2. Print a string to the console containing the bill value, the tip, and the final value (bill + tip). Example: 'The bill was 275, the tip was 41.25, and the total value 316.25'
-
-TEST DATA: Test for bill values 275, 40 and 430
-
-HINT: To calculate 20% of a value, simply multiply it by 20/100 = 0.2
-HINT: Value X is between 50 and 300, if it's >= 50 && <= 300 π
-
-GOOD LUCK π
-*/
-
-/*
-const bill = 430;
-const tip = bill <= 300 && bill >= 50 ? bill * 0.15 : bill * 0.2;
-console.log(`The bill was ${bill}, the tip was ${tip}, and the total value ${bill + tip}`);
-*/
diff --git a/01-Fundamentals-Part-1/starter/index.html b/01-Fundamentals-Part-1/starter/index.html
index 59529c7923..ccf0f9a72c 100755
--- a/01-Fundamentals-Part-1/starter/index.html
+++ b/01-Fundamentals-Part-1/starter/index.html
@@ -1,29 +1,34 @@
-
-
-
-
- JavaScript Fundamentals β Part 1
-
-
-
-
-
-
-
diff --git a/02-Fundamentals-Part-2/final/script.js b/02-Fundamentals-Part-2/final/script.js
deleted file mode 100755
index 8cee2087f7..0000000000
--- a/02-Fundamentals-Part-2/final/script.js
+++ /dev/null
@@ -1,589 +0,0 @@
-'use strict';
-
-/*
-///////////////////////////////////////
-// Activating Strict Mode
-let hasDriversLicense = false;
-const passTest = true;
-
-if (passTest) hasDriversLicense = true;
-if (hasDriversLicense) console.log('I can drive :D');
-
-// const interface = 'Audio';
-// const private = 534;
-
-
-///////////////////////////////////////
-// Functions
-function logger() {
- console.log('My name is Jonas');
-}
-
-// calling / running / invoking function
-logger();
-logger();
-logger();
-
-function fruitProcessor(apples, oranges) {
- const juice = `Juice with ${apples} apples and ${oranges} oranges.`;
- return juice;
-}
-
-const appleJuice = fruitProcessor(5, 0);
-console.log(appleJuice);
-
-const appleOrangeJuice = fruitProcessor(2, 4);
-console.log(appleOrangeJuice);
-
-const num = Number('23');
-
-
-///////////////////////////////////////
-// Function Declarations vs. Expressions
-
-// Function declaration
-function calcAge1(birthYeah) {
- return 2037 - birthYeah;
-}
-const age1 = calcAge1(1991);
-
-// Function expression
-const calcAge2 = function (birthYeah) {
- return 2037 - birthYeah;
-}
-const age2 = calcAge2(1991);
-
-console.log(age1, age2);
-
-
-///////////////////////////////////////
-// Arrow functions
-
-const calcAge3 = birthYeah => 2037 - birthYeah;
-const age3 = calcAge3(1991);
-console.log(age3);
-
-const yearsUntilRetirement = (birthYeah, firstName) => {
- const age = 2037 - birthYeah;
- const retirement = 65 - age;
- // return retirement;
- return `${firstName} retires in ${retirement} years`;
-}
-
-console.log(yearsUntilRetirement(1991, 'Jonas')); console.log(yearsUntilRetirement(1980, 'Bob'));
-
-
-///////////////////////////////////////
-// Functions Calling Other Functions
-function cutFruitPieces(fruit) {
- return fruit * 4;
-}
-
-function fruitProcessor(apples, oranges) {
- const applePieces = cutFruitPieces(apples);
- const orangePieces = cutFruitPieces(oranges);
-
- const juice = `Juice with ${applePieces} piece of apple and ${orangePieces} pieces of orange.`;
- return juice;
-}
-console.log(fruitProcessor(2, 3));
-
-
-///////////////////////////////////////
-// Reviewing Functions
-const calcAge = function (birthYeah) {
- return 2037 - birthYeah;
-}
-
-const yearsUntilRetirement = function (birthYeah, firstName) {
- const age = calcAge(birthYeah);
- const retirement = 65 - age;
-
- if (retirement > 0) {
- console.log(`${firstName} retires in ${retirement} years`);
- return retirement;
- } else {
- console.log(`${firstName} has already retired π`);
- return -1;
- }
-}
-
-console.log(yearsUntilRetirement(1991, 'Jonas'));
-console.log(yearsUntilRetirement(1950, 'Mike'));
-*/
-
-///////////////////////////////////////
-// Coding Challenge #1
-
-/*
-Back to the two gymnastics teams, the Dolphins and the Koalas! There is a new gymnastics discipline, which works differently.
-Each team competes 3 times, and then the average of the 3 scores is calculated (so one average score per team).
-A team ONLY wins if it has at least DOUBLE the average score of the other team. Otherwise, no team wins!
-
-1. Create an arrow function 'calcAverage' to calculate the average of 3 scores
-2. Use the function to calculate the average for both teams
-3. Create a function 'checkWinner' that takes the average score of each team as parameters ('avgDolhins' and 'avgKoalas'), and then logs the winner to the console, together with the victory points, according to the rule above. Example: "Koalas win (30 vs. 13)".
-4. Use the 'checkWinner' function to determine the winner for both DATA 1 and DATA 2.
-5. Ignore draws this time.
-
-TEST DATA 1: Dolphins score 44, 23 and 71. Koalas score 65, 54 and 49
-TEST DATA 2: Dolphins score 85, 54 and 41. Koalas score 23, 34 and 27
-
-HINT: To calculate average of 3 values, add them all together and divide by 3
-HINT: To check if number A is at least double number B, check for A >= 2 * B. Apply this to the team's average scores π
-
-GOOD LUCK π
-*/
-
-/*
-const calcAverage = (a, b, c) => (a + b + c) / 3;
-console.log(calcAverage(3, 4, 5));
-
-// Test 1
-let scoreDolphins = calcAverage(44, 23, 71);
-let scoreKoalas = calcAverage(65, 54, 49);
-console.log(scoreDolphins, scoreKoalas);
-
-const checkWinner = function (avgDolphins, avgKoalas) {
- if (avgDolphins >= 2 * avgKoalas) {
- console.log(`Dolphins win π (${avgDolphins} vs. ${avgKoalas})`);
- } else if (avgKoalas >= 2 * avgDolphins) {
- console.log(`Koalas win π (${avgKoalas} vs. ${avgDolphins})`);
- } else {
- console.log('No team wins...');
- }
-}
-checkWinner(scoreDolphins, scoreKoalas);
-
-checkWinner(576, 111);
-
-// Test 2
-scoreDolphins = calcAverage(85, 54, 41);
-scoreKoalas = calcAverage(23, 34, 27);
-console.log(scoreDolphins, scoreKoalas);
-checkWinner(scoreDolphins, scoreKoalas);
-
-
-///////////////////////////////////////
-// Introduction to Arrays
-const friend1 = 'Michael';
-const friend2 = 'Steven';
-const friend3 = 'Peter';
-
-const friends = ['Michael', 'Steven', 'Peter'];
-console.log(friends);
-
-const y = new Array(1991, 1984, 2008, 2020);
-
-console.log(friends[0]);
-console.log(friends[2]);
-
-console.log(friends.length);
-console.log(friends[friends.length - 1]);
-
-friends[2] = 'Jay';
-console.log(friends);
-// friends = ['Bob', 'Alice']
-
-const firstName = 'Jonas';
-const jonas = [firstName, 'Schmedtmann', 2037 - 1991, 'teacher', friends];
-console.log(jonas);
-console.log(jonas.length);
-
-// Exercise
-const calcAge = function (birthYeah) {
- return 2037 - birthYeah;
-}
-const years = [1990, 1967, 2002, 2010, 2018];
-
-const age1 = calcAge(years[0]);
-const age2 = calcAge(years[1]);
-const age3 = calcAge(years[years.length - 1]);
-console.log(age1, age2, age3);
-
-const ages = [calcAge(years[0]), calcAge(years[1]), calcAge(years[years.length - 1])];
-console.log(ages);
-
-
-///////////////////////////////////////
-// Basic Array Operations (Methods)
-const friends = ['Michael', 'Steven', 'Peter'];
-
-// Add elements
-const newLength = friends.push('Jay');
-console.log(friends);
-console.log(newLength);
-
-friends.unshift('John');
-console.log(friends);
-
-// Remove elements
-friends.pop(); // Last
-const popped = friends.pop();
-console.log(popped);
-console.log(friends);
-
-friends.shift(); // First
-console.log(friends);
-
-console.log(friends.indexOf('Steven'));
-console.log(friends.indexOf('Bob'));
-
-friends.push(23);
-console.log(friends.includes('Steven'));
-console.log(friends.includes('Bob'));
-console.log(friends.includes(23));
-
-if (friends.includes('Steven')) {
- console.log('You have a friend called Steven');
-}
-*/
-
-///////////////////////////////////////
-// Coding Challenge #2
-
-/*
-Steven is still building his tip calculator, using the same rules as before: Tip 15% of the bill if the bill value is between 50 and 300, and if the value is different, the tip is 20%.
-
-1. Write a function 'calcTip' that takes any bill value as an input and returns the corresponding tip, calculated based on the rules above (you can check out the code from first tip calculator challenge if you need to). Use the function type you like the most. Test the function using a bill value of 100.
-2. And now let's use arrays! So create an array 'bills' containing the test data below.
-3. Create an array 'tips' containing the tip value for each bill, calculated from the function you created before.
-4. BONUS: Create an array 'total' containing the total values, so the bill + tip.
-
-TEST DATA: 125, 555 and 44
-
-HINT: Remember that an array needs a value in each position, and that value can actually be the returned value of a function! So you can just call a function as array values (so don't store the tip values in separate variables first, but right in the new array) π
-
-GOOD LUCK π
-*/
-
-/*
-const calcTip = function (bill) {
- return bill >= 50 && bill <= 300 ? bill * 0.15 : bill * 0.2;
-}
-// const calcTip = bill => bill >= 50 && bill <= 300 ? bill * 0.15 : bill * 0.2;
-
-const bills = [125, 555, 44];
-const tips = [calcTip(bills[0]), calcTip(bills[1]), calcTip(bills[2])];
-const totals = [bills[0] + tips[0], bills[1] + tips[1], bills[2] + tips[2]];
-
-console.log(bills, tips, totals);
-
-
-///////////////////////////////////////
-// Introduction to Objects
-const jonasArray = [
- 'Jonas',
- 'Schmedtmann',
- 2037 - 1991,
- 'teacher',
- ['Michael', 'Peter', 'Steven']
-];
-
-const jonas = {
- firstName: 'Jonas',
- lastName: 'Schmedtmann',
- age: 2037 - 1991,
- job: 'teacher',
- friends: ['Michael', 'Peter', 'Steven']
-};
-
-
-///////////////////////////////////////
-// Dot vs. Bracket Notation
-const jonas = {
- firstName: 'Jonas',
- lastName: 'Schmedtmann',
- age: 2037 - 1991,
- job: 'teacher',
- friends: ['Michael', 'Peter', 'Steven']
-};
-console.log(jonas);
-
-console.log(jonas.lastName);
-console.log(jonas['lastName']);
-
-const nameKey = 'Name';
-console.log(jonas['first' + nameKey]);
-console.log(jonas['last' + nameKey]);
-
-// console.log(jonas.'last' + nameKey)
-
-const interestedIn = prompt('What do you want to know about Jonas? Choose between firstName, lastName, age, job, and friends');
-
-if (jonas[interestedIn]) {
- console.log(jonas[interestedIn]);
-} else {
- console.log('Wrong request! Choose between firstName, lastName, age, job, and friends');
-}
-
-jonas.location = 'Portugal';
-jonas['twitter'] = '@jonasschmedtman';
-console.log(jonas);
-
-// Challenge
-// "Jonas has 3 friends, and his best friend is called Michael"
-console.log(`${jonas.firstName} has ${jonas.friends.length} friends, and his best friend is called ${jonas.friends[0]}`);
-
-
-///////////////////////////////////////
-// Object Methods
-
-const jonas = {
- firstName: 'Jonas',
- lastName: 'Schmedtmann',
- birthYeah: 1991,
- job: 'teacher',
- friends: ['Michael', 'Peter', 'Steven'],
- hasDriversLicense: true,
-
- // calcAge: function (birthYeah) {
- // return 2037 - birthYeah;
- // }
-
- // calcAge: function () {
- // // console.log(this);
- // return 2037 - this.birthYeah;
- // }
-
- calcAge: function () {
- this.age = 2037 - this.birthYeah;
- return this.age;
- },
-
- getSummary: function () {
- return `${this.firstName} is a ${this.calcAge()}-year old ${jonas.job}, and he has ${this.hasDriversLicense ? 'a' : 'no'} driver's license.`
- }
-};
-
-console.log(jonas.calcAge());
-
-console.log(jonas.age);
-console.log(jonas.age);
-console.log(jonas.age);
-
-// Challenge
-// "Jonas is a 46-year old teacher, and he has a driver's license"
-console.log(jonas.getSummary());
-*/
-
-///////////////////////////////////////
-// Coding Challenge #3
-
-/*
-Let's go back to Mark and John comparing their BMIs! This time, let's use objects to implement the calculations! Remember: BMI = mass / height ** 2 = mass / (height * height). (mass in kg and height in meter)
-
-1. For each of them, create an object with properties for their full name, mass, and height (Mark Miller and John Smith)
-2. Create a 'calcBMI' method on each object to calculate the BMI (the same method on both objects). Store the BMI value to a property, and also return it from the method.
-3. Log to the console who has the higher BMI, together with the full name and the respective BMI. Example: "John Smith's BMI (28.3) is higher than Mark Miller's (23.9)!"
-
-TEST DATA: Marks weights 78 kg and is 1.69 m tall. John weights 92 kg and is 1.95 m tall.
-
-GOOD LUCK π
-*/
-
-/*
-const mark = {
- fullName: 'Mark Miller',
- mass: 78,
- height: 1.69,
- calcBMI: function () {
- this.bmi = this.mass / this.height ** 2;
- return this.bmi;
- }
-};
-
-const john = {
- fullName: 'John Smith',
- mass: 92,
- height: 1.95,
- calcBMI: function () {
- this.bmi = this.mass / this.height ** 2;
- return this.bmi;
- }
-};
-
-mark.calcBMI();
-john.calcBMI();
-
-console.log(mark.bmi, john.bmi);
-
-// "John Smith's BMI (28.3) is higher than Mark Miller's (23.9)!"
-
-if (mark.bmi > john.bmi) {
- console.log(`${mark.fullName}'s BMI (${mark.bmi}) is higher than ${john.fullName}'s BMI (${john.bmi})`)
-} else if (john.bmi > mark.bmi) {
- console.log(`${john.fullName}'s BMI (${john.bmi}) is higher than ${mark.fullName}'s BMI (${mark.bmi})`)
-}
-
-
-///////////////////////////////////////
-// Iteration: The for Loop
-
-// console.log('Lifting weights repetition 1 ποΈββοΈ');
-// console.log('Lifting weights repetition 2 ποΈββοΈ');
-// console.log('Lifting weights repetition 3 ποΈββοΈ');
-// console.log('Lifting weights repetition 4 ποΈββοΈ');
-// console.log('Lifting weights repetition 5 ποΈββοΈ');
-// console.log('Lifting weights repetition 6 ποΈββοΈ');
-// console.log('Lifting weights repetition 7 ποΈββοΈ');
-// console.log('Lifting weights repetition 8 ποΈββοΈ');
-// console.log('Lifting weights repetition 9 ποΈββοΈ');
-// console.log('Lifting weights repetition 10 ποΈββοΈ');
-
-// for loop keeps running while condition is TRUE
-for (let rep = 1; rep <= 30; rep++) {
- console.log(`Lifting weights repetition ${rep} ποΈββοΈ`);
-}
-
-
-///////////////////////////////////////
-// Looping Arrays, Breaking and Continuing
-const jonas = [
- 'Jonas',
- 'Schmedtmann',
- 2037 - 1991,
- 'teacher',
- ['Michael', 'Peter', 'Steven'],
- true
-];
-const types = [];
-
-// console.log(jonas[0])
-// console.log(jonas[1])
-// ...
-// console.log(jonas[4])
-// jonas[5] does NOT exist
-
-for (let i = 0; i < jonas.length; i++) {
- // Reading from jonas array
- console.log(jonas[i], typeof jonas[i]);
-
- // Filling types array
- // types[i] = typeof jonas[i];
- types.push(typeof jonas[i]);
-}
-
-console.log(types);
-
-const years = [1991, 2007, 1969, 2020];
-const ages = [];
-
-for (let i = 0; i < years.length; i++) {
- ages.push(2037 - years[i]);
-}
-console.log(ages);
-
-// continue and break
-console.log('--- ONLY STRINGS ---')
-for (let i = 0; i < jonas.length; i++) {
- if (typeof jonas[i] !== 'string') continue;
-
- console.log(jonas[i], typeof jonas[i]);
-}
-
-console.log('--- BREAK WITH NUMBER ---')
-for (let i = 0; i < jonas.length; i++) {
- if (typeof jonas[i] === 'number') break;
-
- console.log(jonas[i], typeof jonas[i]);
-}
-
-
-///////////////////////////////////////
-// Looping Backwards and Loops in Loops
-const jonas = [
- 'Jonas',
- 'Schmedtmann',
- 2037 - 1991,
- 'teacher',
- ['Michael', 'Peter', 'Steven'],
- true
-];
-
-// 0, 1, ..., 4
-// 4, 3, ..., 0
-
-for (let i = jonas.length - 1; i >= 0; i--) {
- console.log(i, jonas[i]);
-}
-
-for (let exercise = 1; exercise < 4; exercise++) {
- console.log(`-------- Starting exercise ${exercise}`);
-
- for (let rep = 1; rep < 6; rep++) {
- console.log(`Exercise ${exercise}: Lifting weight repetition ${rep} ποΈββοΈ`);
- }
-}
-
-
-///////////////////////////////////////
-// The while Loop
-for (let rep = 1; rep <= 10; rep++) {
- console.log(`Lifting weights repetition ${rep} ποΈββοΈ`);
-}
-
-let rep = 1;
-while (rep <= 10) {
- // console.log(`WHILE: Lifting weights repetition ${rep} ποΈββοΈ`);
- rep++;
-}
-
-let dice = Math.trunc(Math.random() * 6) + 1;
-
-while (dice !== 6) {
- console.log(`You rolled a ${dice}`);
- dice = Math.trunc(Math.random() * 6) + 1;
- if (dice === 6) console.log('Loop is about to end...');
-}
-*/
-
-///////////////////////////////////////
-// Coding Challenge #4
-
-/*
-Let's improve Steven's tip calculator even more, this time using loops!
-
-1. Create an array 'bills' containing all 10 test bill values
-2. Create empty arrays for the tips and the totals ('tips' and 'totals')
-3. Use the 'calcTip' function we wrote before (no need to repeat) to calculate tips and total values (bill + tip) for every bill value in the bills array. Use a for loop to perform the 10 calculations!
-
-TEST DATA: 22, 295, 176, 440, 37, 105, 10, 1100, 86 and 52
-
-HINT: Call calcTip in the loop and use the push method to add values to the tips and totals arrays π
-
-4. BONUS: Write a function 'calcAverage' which takes an array called 'arr' as an argument. This function calculates the average of all numbers in the given array. This is a DIFFICULT challenge (we haven't done this before)! Here is how to solve it:
- 4.1. First, you will need to add up all values in the array. To do the addition, start by creating a variable 'sum' that starts at 0. Then loop over the array using a for loop. In each iteration, add the current value to the 'sum' variable. This way, by the end of the loop, you have all values added together
- 4.2. To calculate the average, divide the sum you calculated before by the length of the array (because that's the number of elements)
- 4.3. Call the function with the 'totals' array
-
-GOOD LUCK π
-*/
-
-/*
-const calcTip = function (bill) {
- return bill >= 50 && bill <= 300 ? bill * 0.15 : bill * 0.2;
-}
-const bills = [22, 295, 176, 440, 37, 105, 10, 1100, 86, 52];
-const tips = [];
-const totals = [];
-
-for (let i = 0; i < bills.length; i++) {
- const tip = calcTip(bills[i]);
- tips.push(tip);
- totals.push(tip + bills[i]);
-}
-console.log(bills, tips, totals);
-
-const calcAverage = function (arr) {
- let sum = 0;
- for (let i = 0; i < arr.length; i++) {
- // sum = sum + arr[i];
- sum += arr[i];
- }
- return sum / arr.length;
-}
-console.log(calcAverage([2, 3, 7]));
-console.log(calcAverage(totals));
-console.log(calcAverage(tips));
-*/
diff --git a/03-Developer-Skills/final/.prettierrc b/03-Developer-Skills/final/.prettierrc
deleted file mode 100644
index b4f8e6a6a1..0000000000
--- a/03-Developer-Skills/final/.prettierrc
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "singleQuote": true,
- "arrowParens": "avoid"
-}
diff --git a/03-Developer-Skills/final/index.html b/03-Developer-Skills/final/index.html
deleted file mode 100644
index fe26bd2b09..0000000000
--- a/03-Developer-Skills/final/index.html
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
-
-
-
- Developer Skills & Editor Setup
-
-
-
-
Developer Skills & Editor Setup
-
-
-
diff --git a/03-Developer-Skills/final/script.js b/03-Developer-Skills/final/script.js
deleted file mode 100644
index eceaebbc72..0000000000
--- a/03-Developer-Skills/final/script.js
+++ /dev/null
@@ -1,161 +0,0 @@
-// Remember, we're gonna use strict mode in all scripts now!
-'use strict';
-
-/*
-///////////////////////////////////////
-// Using Google, StackOverflow and MDN
-
-// PROBLEM 1:
-// We work for a company building a smart home thermometer. Our most recent task is this: "Given an array of temperatures of one day, calculate the temperature amplitude. Keep in mind that sometimes there might be a sensor error."
-
-const temperatures = [3, -2, -6, -1, 'error', 9, 13, 17, 15, 14, 9, 5];
-
-// 1) Understanding the problem
-// - What is temp amplitude? Answer: difference between highest and lowest temp
-// - How to compute max and min temperatures?
-// - What's a sensor error? And what do do?
-
-// 2) Breaking up into sub-problems
-// - How to ignore errors?
-// - Find max value in temp array
-// - Find min value in temp array
-// - Subtract min from max (amplitude) and return it
-
-const calcTempAmplitude = function (temps) {
- let max = temps[0];
- let min = temps[0];
-
- for (let i = 0; i < temps.length; i++) {
- const curTemp = temps[i];
- if (typeof curTemp !== 'number') continue;
-
- if (curTemp > max) max = curTemp;
- if (curTemp < min) min = curTemp;
- }
- console.log(max, min);
- return max - min;
-};
-const amplitude = calcTempAmplitude(temperatures);
-console.log(amplitude);
-
-// PROBLEM 2:
-// Function should now receive 2 arrays of temps
-
-// 1) Understanding the problem
-// - With 2 arrays, should we implement functionality twice? NO! Just merge two arrays
-
-// 2) Breaking up into sub-problems
-// - Merge 2 arrays
-
-const calcTempAmplitudeNew = function (t1, t2) {
- const temps = t1.concat(t2);
- console.log(temps);
-
- let max = temps[0];
- let min = temps[0];
-
- for (let i = 0; i < temps.length; i++) {
- const curTemp = temps[i];
- if (typeof curTemp !== 'number') continue;
-
- if (curTemp > max) max = curTemp;
- if (curTemp < min) min = curTemp;
- }
- console.log(max, min);
- return max - min;
-};
-const amplitudeNew = calcTempAmplitudeNew([3, 5, 1], [9, 0, 5]);
-console.log(amplitudeNew);
-
-
-///////////////////////////////////////
-// Debugging with the Console and Breakpoints
-const measureKelvin = function () {
- const measurement = {
- type: 'temp',
- unit: 'celsius',
-
- // C) FIX
- // value: Number(prompt('Degrees celsius:')),
- value: 10,
- };
-
- // B) FIND
- console.table(measurement);
-
- // console.log(measurement.value);
- // console.warn(measurement.value);
- // console.error(measurement.value);
-
- const kelvin = measurement.value + 273;
- return kelvin;
-};
-// A) IDENTIFY
-console.log(measureKelvin());
-
-// Using a debugger
-const calcTempAmplitudeBug = function (t1, t2) {
- const temps = t1.concat(t2);
- console.log(temps);
-
- let max = 0;
- let min = 0;
-
- for (let i = 0; i < temps.length; i++) {
- const curTemp = temps[i];
- if (typeof curTemp !== 'number') continue;
-
- if (curTemp > max) max = curTemp;
- if (curTemp < min) min = curTemp;
- }
- console.log(max, min);
- return max - min;
-};
-const amplitudeBug = calcTempAmplitudeBug([3, 5, 1], [9, 4, 5]);
-// A) IDENTIFY
-console.log(amplitudeBug);
-*/
-
-///////////////////////////////////////
-// Coding Challenge #1
-
-/*
-Given an array of forecasted maximum temperatures, the thermometer displays a string with these temperatures.
-
-Example: [17, 21, 23] will print "... 17ΒΊC in 1 days ... 21ΒΊC in 2 days ... 23ΒΊC in 3 days ..."
-
-Create a function 'printForecast' which takes in an array 'arr' and logs a string like the above to the console.
-
-Use the problem-solving framework: Understand the problem and break it up into sub-problems!
-
-TEST DATA 1: [17, 21, 23]
-TEST DATA 2: [12, 5, -5, 0, 4]
-*/
-
-/*
-// 1) Understanding the problem
-// - Array transformed to string, separated by ...
-// - What is the X days? Answer: index + 1
-
-// 2) Breaking up into sub-problems
-// - Transform array into string
-// - Transform each element to string with ΒΊC
-// - Strings needs to contain day (index + 1)
-// - Add ... between elements and start and end of string
-// - Log string to console
-
-const data1 = [17, 21, 23];
-const data2 = [12, 5, -5, 0, 4];
-
-console.log(`... ${data1[0]}ΒΊC ... ${data1[1]}ΒΊC ... ${data1[2]}ΒΊC ...`);
-
-const printForecast = function (arr) {
- let str = '';
- for (let i = 0; i < arr.length; i++) {
- str += `${arr[i]}ΒΊC in ${i + 1} days ... `;
- }
- console.log('...' + str);
-};
-printForecast(data1);
-*/
-
diff --git a/05-Guess-My-Number/final/.prettierrc b/05-Guess-My-Number/final/.prettierrc
deleted file mode 100644
index b4f8e6a6a1..0000000000
--- a/05-Guess-My-Number/final/.prettierrc
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "singleQuote": true,
- "arrowParens": "avoid"
-}
diff --git a/05-Guess-My-Number/final/index.html b/05-Guess-My-Number/final/index.html
deleted file mode 100644
index b25c17540a..0000000000
--- a/05-Guess-My-Number/final/index.html
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
-
-
-
- Guess My Number!
-
-
-
-
- Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
- tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
- veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
- commodo consequat. Duis aute irure dolor in reprehenderit in voluptate
- velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
- occaecat cupidatat non proident, sunt in culpa qui officia deserunt
- mollit anim id est laborum.
-