From 3f54ae028d6cf0a32068c3a99269fcbf7b9f1646 Mon Sep 17 00:00:00 2001 From: Madelyn Romero Date: Wed, 30 Apr 2025 12:55:18 -0600 Subject: [PATCH 01/21] Complete Strings and Template Literals practice --- 01-Fundamentals-Part-1/starter/assignments.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/01-Fundamentals-Part-1/starter/assignments.js b/01-Fundamentals-Part-1/starter/assignments.js index 4a2a979078..9f29826ffa 100644 --- a/01-Fundamentals-Part-1/starter/assignments.js +++ b/01-Fundamentals-Part-1/starter/assignments.js @@ -36,16 +36,22 @@ const language = "English"; // Basic Operators const halfPopulation = population / 2; -console.log(halfPopulation); +// console.log(halfPopulation); population += 1; -console.log(population); +// console.log(population); const populationFinland = 6; -console.log(population > populationFinland); +// console.log(population > populationFinland); const averagePopulation = 33; -console.log(population < averagePopulation); +// console.log(population < averagePopulation); const description = country + " is in " + continent + ", and its " + population + " million people speak " + language console.log(description); + + +// Strings and Template Literals + +const newDescription = `${country} is in ${continent}, and its ${population} million people speak ${language}` +console.log(newDescription); From fc814f0acb7b9ca25a09c34de70be6d97e849a71 Mon Sep 17 00:00:00 2001 From: Madelyn Romero Date: Wed, 30 Apr 2025 13:27:33 -0600 Subject: [PATCH 02/21] Complete if else statements practice --- 01-Fundamentals-Part-1/starter/assignments.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/01-Fundamentals-Part-1/starter/assignments.js b/01-Fundamentals-Part-1/starter/assignments.js index 9f29826ffa..d525a977e9 100644 --- a/01-Fundamentals-Part-1/starter/assignments.js +++ b/01-Fundamentals-Part-1/starter/assignments.js @@ -2,7 +2,6 @@ // Values and Variables - // let country = "United States of America"; // let continent = "North America"; // let population = 340.1; @@ -13,7 +12,6 @@ // Data Types - // let isIsland = false; // let language; @@ -24,7 +22,6 @@ // let, const, and var - const country = "United States of America"; const continent = "North America"; let population = 340.1; @@ -34,7 +31,6 @@ const language = "English"; // Basic Operators - const halfPopulation = population / 2; // console.log(halfPopulation); @@ -48,10 +44,17 @@ const averagePopulation = 33; // console.log(population < averagePopulation); const description = country + " is in " + continent + ", and its " + population + " million people speak " + language -console.log(description); +// console.log(description); // Strings and Template Literals - const newDescription = `${country} is in ${continent}, and its ${population} million people speak ${language}` -console.log(newDescription); +// console.log(newDescription); + + +// Taking Decisions: if/else Statements +if (population > averagePopulation) { + console.log(`${country}'s population is ${population - averagePopulation} above average.`); +} else { + console.log(`${country}'s population is ${averagePopulation - population} below average.`); +} From 4bcfcbda05691f6a0cc53202a6204037738cd936 Mon Sep 17 00:00:00 2001 From: Madelyn Romero Date: Wed, 30 Apr 2025 13:28:17 -0600 Subject: [PATCH 03/21] Complete coding challenge #2 --- .../starter/codingChallenges.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/01-Fundamentals-Part-1/starter/codingChallenges.js b/01-Fundamentals-Part-1/starter/codingChallenges.js index eb0b246c88..e22cc7eeee 100644 --- a/01-Fundamentals-Part-1/starter/codingChallenges.js +++ b/01-Fundamentals-Part-1/starter/codingChallenges.js @@ -7,9 +7,24 @@ const heightMark = 1.69; const weightJohn = 92; const heightJohn = 1.95; +// const weightMark = 95; +// const heightMark = 1.88; + +// const weightJohn = 85; +// const heightJohn = 1.76; + const bmiMark = weightMark / heightMark ** 2; const bmiJohn = weightJohn / (heightJohn * heightJohn); const markHigherBMI = bmiMark > bmiJohn; -console.log(bmiMark, bmiJohn, markHigherBMI); +// console.log(bmiMark, bmiJohn, markHigherBMI); + + +// Coding Challenge #2 + +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 Mark's (${bmiMark})!`); +} From 94c432f19d42fdaa493b69d38e20f9617f8e76ff Mon Sep 17 00:00:00 2001 From: Madelyn Romero Date: Wed, 30 Apr 2025 13:47:53 -0600 Subject: [PATCH 04/21] Complete type conversion and coercion practice --- 01-Fundamentals-Part-1/starter/assignments.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/01-Fundamentals-Part-1/starter/assignments.js b/01-Fundamentals-Part-1/starter/assignments.js index d525a977e9..9836a31f65 100644 --- a/01-Fundamentals-Part-1/starter/assignments.js +++ b/01-Fundamentals-Part-1/starter/assignments.js @@ -54,7 +54,15 @@ const newDescription = `${country} is in ${continent}, and its ${population} mil // Taking Decisions: if/else Statements if (population > averagePopulation) { - console.log(`${country}'s population is ${population - averagePopulation} above average.`); + // console.log(`${country}'s population is ${population - averagePopulation} above average.`); } else { - console.log(`${country}'s population is ${averagePopulation - population} below average.`); + // console.log(`${country}'s population is ${averagePopulation - population} below average.`); } + + +// Type Conversion and Coercion +console.log("9" - "5"); // 4 +console.log("19" - "13" + "17"); // "617" +console.log("19" - "13" + 17); // 23 +console.log("123" < 57); // false +console.log(5 + 6 + "4" + 9 - 4 - 2); // 1143 From cd44c0435b7c7705d5cc02169963bddf6b5eccd8 Mon Sep 17 00:00:00 2001 From: Madelyn Romero Date: Wed, 30 Apr 2025 14:00:17 -0600 Subject: [PATCH 05/21] Adding notes from lessons so far --- 01-Fundamentals-Part-1/starter/script.js | 86 ++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 01-Fundamentals-Part-1/starter/script.js diff --git a/01-Fundamentals-Part-1/starter/script.js b/01-Fundamentals-Part-1/starter/script.js new file mode 100644 index 0000000000..72786caa57 --- /dev/null +++ b/01-Fundamentals-Part-1/starter/script.js @@ -0,0 +1,86 @@ +// // Basic Operators +// const now = 2037; +// const ageJonas = now - 1991; +// const ageSarah = now - 2020; + +// console.log(ageJonas, ageSarah); + +// console.log(ageJonas * 2, ageJonas / 10, 2 ** 3); + +// const firstName = "Madelyn"; +// const lastName = "Romero"; +// console.log(firstName + " " + lastName); + +// let x = 10 + 5; +// x += 10; +// x *= 4; +// x++; +// x--; +// x--; + +// console.log(x); + + +// console.log(ageJonas > ageSarah); +// console.log(ageSarah >= 18); + +// const isFullAge = ageSarah >= 18; + +// console.log(now - 1991 > now - 2018); + + +// // Operator Precendence +// 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; + +// console.log(x, y); + +// const averageAge = (ageJonas + ageSarah) / 2 +// console.log(ageJonas, ageSarah, averageAge); + + +// // Strings and Template Literals +// const firstName = "Madelyn"; +// const job = "Software Engineer"; +// const birthYear = 1991; +// const year = 2037; + +// const madelyn = `I'm ` + firstName + " a " + (year - birthYear) + " year old " + job + "!"; +// const madelynNew = `I'm ${firstName}, a ${year - birthYear} year old ${job}!` + +// console.log(madelyn); +// console.log(madelynNew); + +// console.log("String with \n\ +// multiple \n\ +// lines"); + +// console.log(`String with +// multiple +// lines`); + + +// // Type Conversion and Coercion +// const inputYear = "1991"; +// console.log(Number(inputYear), inputYear); + +// console.log(Number(inputYear) + 18); + +// console.log(Number("Madelyn")); +// console.log(typeof NaN); + +// console.log(String(23), 23); + + +// console.log(`I am ` + 23 + ` years old`); +// console.log("23" - "10" - 3); + +// console.log(typeof ("1" + 1)); +// console.log(typeof (1 + "1")); From 187149916ffbd49713934fcf4f9172fd67888cca Mon Sep 17 00:00:00 2001 From: Madelyn Romero Date: Wed, 30 Apr 2025 14:05:52 -0600 Subject: [PATCH 06/21] Fix styling of main script --- 01-Fundamentals-Part-1/starter/script.js | 148 ++++++++++++++--------- 1 file changed, 92 insertions(+), 56 deletions(-) diff --git a/01-Fundamentals-Part-1/starter/script.js b/01-Fundamentals-Part-1/starter/script.js index 72786caa57..a190b3aca0 100644 --- a/01-Fundamentals-Part-1/starter/script.js +++ b/01-Fundamentals-Part-1/starter/script.js @@ -1,86 +1,122 @@ -// // Basic Operators -// const now = 2037; -// const ageJonas = now - 1991; -// const ageSarah = now - 2020; +/* +// Basic Operators +const now = 2037; +const ageJonas = now - 1991; +const ageSarah = now - 2020; -// console.log(ageJonas, ageSarah); +console.log(ageJonas, ageSarah); -// console.log(ageJonas * 2, ageJonas / 10, 2 ** 3); +console.log(ageJonas * 2, ageJonas / 10, 2 ** 3); -// const firstName = "Madelyn"; -// const lastName = "Romero"; -// console.log(firstName + " " + lastName); +const firstName = "Madelyn"; +const lastName = "Romero"; +console.log(firstName + " " + lastName); -// let x = 10 + 5; -// x += 10; -// x *= 4; -// x++; -// x--; -// x--; +let x = 10 + 5; +x += 10; +x *= 4; +x++; +x--; +x--; -// console.log(x); +console.log(x); -// console.log(ageJonas > ageSarah); -// console.log(ageSarah >= 18); +console.log(ageJonas > ageSarah); +console.log(ageSarah >= 18); -// const isFullAge = ageSarah >= 18; +const isFullAge = ageSarah >= 18; -// console.log(now - 1991 > now - 2018); +console.log(now - 1991 > now - 2018); +*/ -// // Operator Precendence -// const now = 2037; -// const ageJonas = now - 1991; -// const ageSarah = now - 2018; -// console.log(now - 1991 > now - 2018); +/* +// Operator Precendence +const now = 2037; +const ageJonas = now - 1991; +const ageSarah = now - 2018; -// let x, y; +console.log(now - 1991 > now - 2018); -// x = y = 25 - 10 - 5; +let x, y; -// console.log(x, y); +x = y = 25 - 10 - 5; -// const averageAge = (ageJonas + ageSarah) / 2 -// console.log(ageJonas, ageSarah, averageAge); +console.log(x, y); +const averageAge = (ageJonas + ageSarah) / 2 +console.log(ageJonas, ageSarah, averageAge); +*/ -// // Strings and Template Literals -// const firstName = "Madelyn"; -// const job = "Software Engineer"; -// const birthYear = 1991; -// const year = 2037; -// const madelyn = `I'm ` + firstName + " a " + (year - birthYear) + " year old " + job + "!"; -// const madelynNew = `I'm ${firstName}, a ${year - birthYear} year old ${job}!` -// console.log(madelyn); -// console.log(madelynNew); +/* +// Strings and Template Literals +const firstName = "Madelyn"; +const job = "Software Engineer"; +const birthYear = 1991; +const year = 2037; -// console.log("String with \n\ -// multiple \n\ -// lines"); +const madelyn = `I'm ` + firstName + " a " + (year - birthYear) + " year old " + job + "!"; +const madelynNew = `I'm ${firstName}, a ${year - birthYear} year old ${job}!` -// console.log(`String with -// multiple -// lines`); +console.log(madelyn); +console.log(madelynNew); +console.log("String with \n\ + multiple \n\ + lines"); -// // Type Conversion and Coercion -// const inputYear = "1991"; -// console.log(Number(inputYear), inputYear); +console.log(`String with + multiple + lines`); +*/ -// console.log(Number(inputYear) + 18); -// console.log(Number("Madelyn")); -// console.log(typeof NaN); -// console.log(String(23), 23); +/* +// Taking Decision: if/else Statements +const age = 18; +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.`); +} -// console.log(`I am ` + 23 + ` years old`); -// console.log("23" - "10" - 3); +const birthYear = 1991; +let century; -// console.log(typeof ("1" + 1)); -// console.log(typeof (1 + "1")); +if (birthYear <= 2000) { + century = 20; +} else { + century = 21; +} + +// console.log(century); +*/ + + + +/* +// Type Conversion and Coercion +const inputYear = "1991"; +console.log(Number(inputYear), inputYear); + +console.log(Number(inputYear) + 18); + +console.log(Number("Madelyn")); +console.log(typeof NaN); + +console.log(String(23), 23); + + +console.log(`I am ` + 23 + ` years old`); +console.log("23" - "10" - 3); + +console.log(typeof ("1" + 1)); +console.log(typeof (1 + "1")); +*/ From ce6012c34abb40f93138eda50c43984bf93653ce Mon Sep 17 00:00:00 2001 From: Madelyn Romero Date: Wed, 30 Apr 2025 14:09:02 -0600 Subject: [PATCH 07/21] Fix styling of assignments script --- 01-Fundamentals-Part-1/starter/assignments.js | 63 ++++++++++--------- 1 file changed, 34 insertions(+), 29 deletions(-) diff --git a/01-Fundamentals-Part-1/starter/assignments.js b/01-Fundamentals-Part-1/starter/assignments.js index 9836a31f65..baac0afa7f 100644 --- a/01-Fundamentals-Part-1/starter/assignments.js +++ b/01-Fundamentals-Part-1/starter/assignments.js @@ -1,7 +1,6 @@ // JavaScript Fundamentals 1 - -// Values and Variables +// // Values and Variables // let country = "United States of America"; // let continent = "North America"; // let population = 340.1; @@ -11,7 +10,8 @@ // console.log(population); -// Data Types + +// // Data Types // let isIsland = false; // let language; @@ -21,48 +21,53 @@ // console.log(typeof language); -// let, const, and var -const country = "United States of America"; -const continent = "North America"; -let population = 340.1; -const isIsland = false; -const language = "English"; + +// // let, const, and var +// const country = "United States of America"; +// const continent = "North America"; +// let population = 340.1; +// const isIsland = false; +// const language = "English"; // isIsland = true; -// Basic Operators -const halfPopulation = population / 2; + +// // Basic Operators +// const halfPopulation = population / 2; // console.log(halfPopulation); -population += 1; +// population += 1; // console.log(population); -const populationFinland = 6; +// const populationFinland = 6; // console.log(population > populationFinland); -const averagePopulation = 33; +// const averagePopulation = 33; // console.log(population < averagePopulation); -const description = country + " is in " + continent + ", and its " + population + " million people speak " + language +// const description = country + " is in " + continent + ", and its " + population + " million people speak " + language // console.log(description); -// Strings and Template Literals -const newDescription = `${country} is in ${continent}, and its ${population} million people speak ${language}` + +// // Strings and Template Literals +// const newDescription = `${country} is in ${continent}, and its ${population} million people speak ${language}` // console.log(newDescription); -// Taking Decisions: if/else Statements -if (population > averagePopulation) { - // console.log(`${country}'s population is ${population - averagePopulation} above average.`); -} else { - // console.log(`${country}'s population is ${averagePopulation - population} below average.`); -} + +// // Taking Decisions: if/else Statements +// if (population > averagePopulation) { +// console.log(`${country}'s population is ${population - averagePopulation} above average.`); +// } else { +// console.log(`${country}'s population is ${averagePopulation - population} below average.`); +// } + -// Type Conversion and Coercion -console.log("9" - "5"); // 4 -console.log("19" - "13" + "17"); // "617" -console.log("19" - "13" + 17); // 23 -console.log("123" < 57); // false -console.log(5 + 6 + "4" + 9 - 4 - 2); // 1143 +// // Type Conversion and Coercion +// console.log("9" - "5"); // 4 +// console.log("19" - "13" + "17"); // "617" +// console.log("19" - "13" + 17); // 23 +// console.log("123" < 57); // false +// console.log(5 + 6 + "4" + 9 - 4 - 2); // 1143 From f38a2c864e15240e8bc6b46bc6b427d618367e05 Mon Sep 17 00:00:00 2001 From: Madelyn Romero Date: Wed, 30 Apr 2025 14:10:39 -0600 Subject: [PATCH 08/21] Fix styling of coding challenge script --- .../starter/codingChallenges.js | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/01-Fundamentals-Part-1/starter/codingChallenges.js b/01-Fundamentals-Part-1/starter/codingChallenges.js index e22cc7eeee..7f09af4238 100644 --- a/01-Fundamentals-Part-1/starter/codingChallenges.js +++ b/01-Fundamentals-Part-1/starter/codingChallenges.js @@ -1,30 +1,30 @@ // JavaScript Fundamentals Part 1 -// Coding Challenge #1 -const weightMark = 78; -const heightMark = 1.69; +// // Coding Challenge #1 +// const weightMark = 78; +// const heightMark = 1.69; -const weightJohn = 92; -const heightJohn = 1.95; +// const weightJohn = 92; +// const heightJohn = 1.95; -// const weightMark = 95; -// const heightMark = 1.88; +// // const weightMark = 95; +// // const heightMark = 1.88; -// const weightJohn = 85; -// const heightJohn = 1.76; +// // const weightJohn = 85; +// // const heightJohn = 1.76; -const bmiMark = weightMark / heightMark ** 2; -const bmiJohn = weightJohn / (heightJohn * heightJohn); +// const bmiMark = weightMark / heightMark ** 2; +// const bmiJohn = weightJohn / (heightJohn * heightJohn); -const markHigherBMI = bmiMark > bmiJohn; +// const markHigherBMI = bmiMark > bmiJohn; // console.log(bmiMark, bmiJohn, markHigherBMI); -// Coding Challenge #2 -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 Mark's (${bmiMark})!`); -} +// // Coding Challenge #2 +// 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 Mark's (${bmiMark})!`); +// } From ac67c96797bfa55cdd467d2e39603914cd2f4fec Mon Sep 17 00:00:00 2001 From: Madelyn Romero Date: Wed, 30 Apr 2025 14:56:54 -0600 Subject: [PATCH 09/21] Add notes for truthy and falsy lesson --- 01-Fundamentals-Part-1/starter/script.js | 30 ++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/01-Fundamentals-Part-1/starter/script.js b/01-Fundamentals-Part-1/starter/script.js index a190b3aca0..5487500383 100644 --- a/01-Fundamentals-Part-1/starter/script.js +++ b/01-Fundamentals-Part-1/starter/script.js @@ -120,3 +120,33 @@ console.log("23" - "10" - 3); console.log(typeof ("1" + 1)); console.log(typeof (1 + "1")); */ + + + +/* +// Truthy and Falsy Values +console.log(Boolean(0)); +console.log(Boolean(undefined)); +console.log(Boolean("Madelyn")); +console.log(Boolean({})); +console.log(Boolean("")); + +const money = 100; +if (money) { + console.log("Don't spend it all"); +} else { + console.log("Get that money"); +} + +let height = 0; +if (height) { + console.log("Yay height is defined"); +} else { + console.log("Height is undefined"); +} +*/ + + + + +// Equality Operators From f01b7aa2d8121ca38e0c62637a71d6056f97309e Mon Sep 17 00:00:00 2001 From: Madelyn Romero Date: Wed, 30 Apr 2025 15:10:03 -0600 Subject: [PATCH 10/21] Add notes for equality operators lesson --- 01-Fundamentals-Part-1/starter/script.js | 26 +++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/01-Fundamentals-Part-1/starter/script.js b/01-Fundamentals-Part-1/starter/script.js index 5487500383..288b7fa2db 100644 --- a/01-Fundamentals-Part-1/starter/script.js +++ b/01-Fundamentals-Part-1/starter/script.js @@ -148,5 +148,29 @@ if (height) { - +/* // Equality Operators +const age = 18; +if (age === 18) { + console.log("You just became an adult (strict)"); +} + +if (age == 18) { + console.log("You just became an adult (loose)"); +} + +const favorite = Number(prompt("What's your favorite number?")); +console.log(typeof (favorite), favorite); + +if (favorite === 13) { + console.log("Cool, 13 is a great number"); +} else if (favorite === 7) { + console.log("7 is also a cool number"); +} else { + console.log("Number is not 13 or 7"); +} + +if (favorite !== 13) { + console.log("Why not 13??"); +} +*/ From 301f2ddf03c0368ff713faccc266487d852c3fe2 Mon Sep 17 00:00:00 2001 From: Madelyn Romero Date: Wed, 30 Apr 2025 15:23:36 -0600 Subject: [PATCH 11/21] Complete equality operators practice --- 01-Fundamentals-Part-1/starter/assignments.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/01-Fundamentals-Part-1/starter/assignments.js b/01-Fundamentals-Part-1/starter/assignments.js index baac0afa7f..bb3047a4e8 100644 --- a/01-Fundamentals-Part-1/starter/assignments.js +++ b/01-Fundamentals-Part-1/starter/assignments.js @@ -71,3 +71,16 @@ // console.log("19" - "13" + 17); // 23 // console.log("123" < 57); // false // console.log(5 + 6 + "4" + 9 - 4 - 2); // 1143 + + + +// // Equality Operators: == vs === +// const numNeighbors = Number(prompt("How many neighboring countries does your country have?")); + +// if (numNeighbors === 1) { +// console.log("Only 1 border!"); +// } else if (numNeighbors > 1) { +// console.log("More than 1 border"); +// } else { +// console.log("No borders"); +// } From 493b9eec91131ad31fd1a7754924df72e5bd6182 Mon Sep 17 00:00:00 2001 From: Madelyn Romero Date: Thu, 1 May 2025 16:51:10 -0600 Subject: [PATCH 12/21] Add Boolean Logic notes --- 01-Fundamentals-Part-1/starter/script.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/01-Fundamentals-Part-1/starter/script.js b/01-Fundamentals-Part-1/starter/script.js index 288b7fa2db..701f2943f9 100644 --- a/01-Fundamentals-Part-1/starter/script.js +++ b/01-Fundamentals-Part-1/starter/script.js @@ -174,3 +174,18 @@ if (favorite !== 13) { console.log("Why not 13??"); } */ + + + +/* +// Boolean Logic +const age = 16; +const a = age >= 20; +const b = age < 30; + +console.log(!a); +console.log(a && b); +console.log(a || b); +console.log(!a && b); +console.log(a || !b); +*/ From ce7eb34fe0478f6a2ae397f69f55fc77478db507 Mon Sep 17 00:00:00 2001 From: Madelyn Romero Date: Thu, 1 May 2025 16:58:09 -0600 Subject: [PATCH 13/21] Add Logical Operators notes --- 01-Fundamentals-Part-1/starter/script.js | 28 ++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/01-Fundamentals-Part-1/starter/script.js b/01-Fundamentals-Part-1/starter/script.js index 701f2943f9..9cd73efea1 100644 --- a/01-Fundamentals-Part-1/starter/script.js +++ b/01-Fundamentals-Part-1/starter/script.js @@ -189,3 +189,31 @@ console.log(a || b); console.log(!a && b); console.log(a || !b); */ + + + +/* +// Logical Operators +const hasDriversLicense = true; +const hasGoodVision = true; + +console.log(hasDriversLicense && hasGoodVision); +console.log(hasDriversLicense || hasGoodVision); +console.log(!hasDriversLicense); + +const shouldDrive = hasDriversLicense && hasGoodVision; +if (shouldDrive) { + console.log("Sarah can drive"); +} else { + console.log("Someone else should drive"); +} + +const isTired = false; +console.log(hasDriversLicense && hasGoodVision && isTired); + +if (hasDriversLicense && hasGoodVision && !isTired) { + console.log("Sarah can drive"); +} else { + console.log("Someone else"); +} +*/ From bb0136d570e571c01c5f6a0cb246c68e22c26560 Mon Sep 17 00:00:00 2001 From: Madelyn Romero Date: Thu, 1 May 2025 17:03:07 -0600 Subject: [PATCH 14/21] Complete Logical Operators practice --- 01-Fundamentals-Part-1/starter/assignments.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/01-Fundamentals-Part-1/starter/assignments.js b/01-Fundamentals-Part-1/starter/assignments.js index bb3047a4e8..86231de9c5 100644 --- a/01-Fundamentals-Part-1/starter/assignments.js +++ b/01-Fundamentals-Part-1/starter/assignments.js @@ -84,3 +84,18 @@ // } else { // console.log("No borders"); // } + + + +// // Logical Operators +// const country = "United States of America"; +// const continent = "North America"; +// let population = 34; +// const isIsland = false; +// const language = "English"; + +// if (language === "English" && population < 50 && !isIsland) { +// console.log(`Sarah can live in ${country}!`); +// } else { +// console.log(`${country} does not meet Sarah's criteria`); +// } From 1d6f2ec6d49ece4c2ceb7c2c83797c8a37972fcc Mon Sep 17 00:00:00 2001 From: Madelyn Romero Date: Thu, 1 May 2025 17:37:14 -0600 Subject: [PATCH 15/21] Complete coding challenge #3 --- .../starter/codingChallenges.js | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/01-Fundamentals-Part-1/starter/codingChallenges.js b/01-Fundamentals-Part-1/starter/codingChallenges.js index 7f09af4238..d0b8536bf0 100644 --- a/01-Fundamentals-Part-1/starter/codingChallenges.js +++ b/01-Fundamentals-Part-1/starter/codingChallenges.js @@ -28,3 +28,35 @@ // } else { // console.log(`John's BMI (${bmiJohn}) is higher than Mark's (${bmiMark})!`); // } + + + +// // Coding Challenge #3 +// // const scoreDolphins = (96 + 108 + 89) / 3; +// // const scoreKoalas = (88 + 91 + 110) / 3; +// // console.log(scoreDolphins, scoreKoalas); + +// // if (scoreDolphins > scoreKoalas) { +// // console.log("Dolphins win!"); +// // } else if (scoreKoalas > scoreDolphins) { +// // console.log("Koalas win!"); +// // } else { +// // console.log("Draw!"); +// // } + +// // const scoreDolphins = (97 + 112 + 101) / 3; +// // const scoreKoalas = (109 + 95 + 123) / 3; + +// const scoreDolphins = (97 + 112 + 101) / 3; +// const scoreKoalas = (109 + 95 + 106) / 3; +// console.log(scoreDolphins, scoreKoalas); + +// if (scoreDolphins > scoreKoalas && scoreDolphins >= 100) { +// console.log("Dolphins win!"); +// } else if (scoreKoalas > scoreDolphins && scoreKoalas >= 100) { +// console.log("Koalas win!"); +// } else if (scoreDolphins === scoreKoalas && scoreDolphins >= 100) { +// console.log("Draw!"); +// } else { +// console.log("No winner"); +// } From 9843216b5514e28f5e57dcd7b3ebbc5cf9c253e4 Mon Sep 17 00:00:00 2001 From: Madelyn Romero Date: Thu, 1 May 2025 18:01:00 -0600 Subject: [PATCH 16/21] Add Switch Statement notes --- 01-Fundamentals-Part-1/starter/script.js | 45 ++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/01-Fundamentals-Part-1/starter/script.js b/01-Fundamentals-Part-1/starter/script.js index 9cd73efea1..27d9c60a34 100644 --- a/01-Fundamentals-Part-1/starter/script.js +++ b/01-Fundamentals-Part-1/starter/script.js @@ -217,3 +217,48 @@ if (hasDriversLicense && hasGoodVision && !isTired) { console.log("Someone else"); } */ + + + +/* +// The Switch Statement +const day = "monday"; + +switch (day) { + case "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 weekend!"); + 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 weekend!"); +} else { + console.log("Not a valid day"); +} +*/ From c2a64477622d6c79a269995a655a180426faffa0 Mon Sep 17 00:00:00 2001 From: Madelyn Romero Date: Thu, 1 May 2025 18:19:49 -0600 Subject: [PATCH 17/21] Complete Switch Statement practice --- 01-Fundamentals-Part-1/starter/assignments.js | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/01-Fundamentals-Part-1/starter/assignments.js b/01-Fundamentals-Part-1/starter/assignments.js index 86231de9c5..60a3367c1f 100644 --- a/01-Fundamentals-Part-1/starter/assignments.js +++ b/01-Fundamentals-Part-1/starter/assignments.js @@ -99,3 +99,28 @@ // } else { // console.log(`${country} does not meet Sarah's criteria`); // } + + + +// // The Switch Statement +// const language = "english" +// switch (language) { +// case "chinese": +// case "mandarin": +// console.log("MOST number of native speakers"); +// break +// case "spanish": +// console.log("2nd place in number of native speakers"); +// break +// case "english": +// console.log("3rd place"); +// break +// case "hindi": +// console.log("Number 4"); +// break +// case "arabic": +// console.log("5th most spoken language"); +// break +// default: +// console.log("Great language too"); +// } From 24135e90f9e123b07a6c625235bee7f08b6c5c91 Mon Sep 17 00:00:00 2001 From: Madelyn Romero Date: Thu, 1 May 2025 18:25:46 -0600 Subject: [PATCH 18/21] Add Statements and Expressions notes --- 01-Fundamentals-Part-1/starter/script.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/01-Fundamentals-Part-1/starter/script.js b/01-Fundamentals-Part-1/starter/script.js index 27d9c60a34..f60b671fab 100644 --- a/01-Fundamentals-Part-1/starter/script.js +++ b/01-Fundamentals-Part-1/starter/script.js @@ -262,3 +262,22 @@ if (day === "monday") { console.log("Not a valid day"); } */ + + + +/* +// Statements and Expressions +3 + 4; +1991; +true && false && !false; + +if (23 > 10) { + const str = "23 is bigger"; +} + +console.log(`I'm ${2037 - 1991} years old`); + +// console.log(`${if (23 > 10) { +// const str = "23 is bigger"; +// }}`); +*/ From 56c29560aae9e12a380d6a106a9ca57fa1f030b9 Mon Sep 17 00:00:00 2001 From: Madelyn Romero Date: Thu, 1 May 2025 18:34:51 -0600 Subject: [PATCH 19/21] Add Conditional/Ternary Operator notes --- 01-Fundamentals-Part-1/starter/script.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/01-Fundamentals-Part-1/starter/script.js b/01-Fundamentals-Part-1/starter/script.js index f60b671fab..9d12123fde 100644 --- a/01-Fundamentals-Part-1/starter/script.js +++ b/01-Fundamentals-Part-1/starter/script.js @@ -281,3 +281,26 @@ console.log(`I'm ${2037 - 1991} years old`); // const str = "23 is bigger"; // }}`); */ + + + +/* +// The Conditional (Ternary) Operator +const age = 23; + +age >= 18 ? console.log("I like to drink wine") : console.log("Cannot drink yet"); + +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"}`); +*/ From 51904e1991f9ebd5d65e3310bdc21b6825dbd8fe Mon Sep 17 00:00:00 2001 From: Madelyn Romero Date: Thu, 1 May 2025 18:40:02 -0600 Subject: [PATCH 20/21] Complete Conditional/Ternary Operator practice --- 01-Fundamentals-Part-1/starter/assignments.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/01-Fundamentals-Part-1/starter/assignments.js b/01-Fundamentals-Part-1/starter/assignments.js index 60a3367c1f..841dbb568e 100644 --- a/01-Fundamentals-Part-1/starter/assignments.js +++ b/01-Fundamentals-Part-1/starter/assignments.js @@ -90,7 +90,7 @@ // // Logical Operators // const country = "United States of America"; // const continent = "North America"; -// let population = 34; +// let population = 340.1; // const isIsland = false; // const language = "English"; @@ -124,3 +124,12 @@ // default: // console.log("Great language too"); // } + + + +// // The Conditional (Ternary) Operator +// const country = "United States of America"; +// const averagePopulation = 33; +// let population = 340.1; + +// console.log(`${country}'s population is ${population > averagePopulation ? "above" : "below"} average`); From e2eb9fcf82d0b9767ec72909a1bb982366d34ea9 Mon Sep 17 00:00:00 2001 From: Madelyn Romero Date: Thu, 1 May 2025 18:52:37 -0600 Subject: [PATCH 21/21] Complete Coding Challenge #4 --- 01-Fundamentals-Part-1/starter/codingChallenges.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/01-Fundamentals-Part-1/starter/codingChallenges.js b/01-Fundamentals-Part-1/starter/codingChallenges.js index d0b8536bf0..8b1e4a7515 100644 --- a/01-Fundamentals-Part-1/starter/codingChallenges.js +++ b/01-Fundamentals-Part-1/starter/codingChallenges.js @@ -60,3 +60,11 @@ // } else { // console.log("No winner"); // } + + + +// // Coding Challenge #4 +// const bill = 275; +// const tip = (bill >= 50 && bill <= 300) ? bill * .15 : bill * .20; + +// console.log(`The bill was ${bill}, the tip was ${tip}, and the total value was ${bill + tip}`);