This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Iteration 1: All directors? - Get the array of all directors. | |
// _Bonus_: It seems some of the directors had directed multiple movies so they will pop up multiple times in the array of directors. | |
// How could you "clean" a bit this array and make it unified (without duplicates)? | |
function getAllDirectors(movies) { | |
return movies.map((movie) => { | |
return movie.director; | |
}); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Iteration #1: Find the maximum | |
function maxOfTwoNumbers(a, b) { | |
// if (a > b) { | |
// return a; | |
// } else if (b > a) { | |
// return b; | |
// } else { | |
// return a; | |
// } | |
// if (a > b) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>Apple Pie Recipe</title> | |
<link rel="stylesheet" href="styles/style.css" /> | |
</head> | |
<body> | |
<header> |
Feel free to use this presentation as a reference.
Open this CodeSandbox and start editing. It will automatically create a fork (that is, a duplicate) for you to work on.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ITERATION 1 | |
function updateSubtotal(productElement) { | |
const productPriceElement = productElement.querySelector('.price span'); | |
const productQuantityInputElement = | |
productElement.querySelector('.quantity input'); | |
const priceValue = Number(productPriceElement.innerText); | |
const quantityValue = productQuantityInputElement.valueAsNumber; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Iteration 1: All directors? - Get the array of all directors. | |
// _Bonus_: It seems some of the directors had directed multiple movies so they will pop up multiple times in the array of directors. | |
// How could you "clean" a bit this array and make it unified (without duplicates)? | |
function getAllDirectors(movies) { | |
// const directors = []; | |
// for (const movie of movies) { | |
// directors.push(movie.director); | |
// } | |
// const directors = movies.map((movie) => { | |
// return movie.director; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Iteration #1: Find the maximum | |
function maxOfTwoNumbers(a, b) { | |
// if (a > b) { | |
// return a; | |
// } else if (b > a) { | |
// return b; | |
// } else { | |
// return a; | |
// } | |
// if (a > b) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>Apple Pie Recipe</title> | |
<!-- don't forget to link your styles --> | |
<link rel="preconnect" href="https://fonts.gstatic.com" /> | |
<link | |
href="https://fonts.googleapis.com/css2?family=Lato:wght@300;400&display=swap" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Write your Pizza Builder JavaScript in this file. | |
// Constants | |
let basePrice = 10; | |
let ingredients = { | |
pepperoni: { name: 'pepperoni', price: 1 }, | |
mushrooms: { name: 'Mushrooms', price: 1 }, | |
greenPeppers: { name: 'Green Peppers', price: 1 }, | |
whiteSauce: { name: 'White sauce', price: 3 }, | |
glutenFreeCrust: { name: 'Gluten-free crust', price: 5 } |