diff --git a/1-slides.html b/1-slides.html index 156e360..cabd775 100644 --- a/1-slides.html +++ b/1-slides.html @@ -10,10 +10,6 @@ - - - - @@ -187,9 +183,9 @@ -- + - **The browser's JS `console`** - Local text file in editor, e.g. TextEdit, [VS Code](https://code.visualstudio.com/) - Online playground e.g. [CodePen](https://codepen.io), [CodeSandbox](https://codesandbox.io) - - **The browser's JS `console`** @@ -240,25 +236,33 @@ -- - ### `document` + ```js + document + ```

the entire HTML document

-- - ### `document.title` + ```js + document.title + ```

the page (document) title

-- - ### `document.body` + ```js + document.body + ```

the body element

-- - ### `document.body.children` + ```js + document.body.children + ```

all the elements within the body

@@ -266,39 +270,45 @@ -- - #### `document.getElementById("board")` + ```js + document.getElementById("board") + ``` -

document.querySelector("#board")

+
document.querySelector("#board")

the (first) element with id="board"

-- - #### `document.getElementsByTagName("h1")` + ```js + document.getElementsByTagName("h1") + ``` -

document.querySelectorAll("h1")

+
 document.querySelectorAll("h1")

all the h1 elements

-- - #### `document.getElementsByClassName("player")` + ```js + document.getElementsByClassName("player") + ``` -

document.querySelectorAll(".player")

+
document.querySelectorAll(".player")

all the elements with class="player"

-- -

document.getElementsByClassName("player").length

+
document.getElementsByClassName("player").length
-

document.querySelectorAll(".player").length

+
 document.querySelectorAll(".player").length

the number of elements with class="player"

-- - document.getElementById("p1-name").textContent +
document.getElementById("p1-name").textContent

the text inside the element with id="p1-name"

@@ -335,21 +345,23 @@

document.querySelectorAll(".player").lengthchange the page title

note the double-quotes

-- - document.getElementById("p1-name").textContent = "Sofia" +
document.getElementById("p1-name").textContent = "Sofia"

replace the text of the #p1-name element

-- - document.getElementById("p1-name").append(" & friends") +
document.getElementById("p1-name").append(" & friends")

add to the end of the element's current text

@@ -429,8 +441,14 @@

document.querySelectorAll(".player").length document.querySelectorAll(".player").lengthcharacters

Variables let us **remember** values - ``` + ```js let remember = "Sept. 21"; ``` @@ -820,7 +838,7 @@

characters

Gif from 'The Office' of Michael Scott yelling 'I declare... bankruptcy!' - ``` + ```js let bankruptcy; ``` @@ -830,7 +848,7 @@

characters

### Assigning a variable - ``` + ```js let myDeclaredVariable; myDeclaredVariable = "so value, much wow"; ``` @@ -839,7 +857,7 @@

characters

### Declaring & assigning at once - ``` + ```js let myAssignedVariable = "such efficient, amaze"; ``` @@ -851,7 +869,7 @@

characters

aka a variable that can't be changed - ``` + ```js const myUnchangeableVariable = "Never gonna give you up"; ``` @@ -914,7 +932,7 @@

characters

What happens when this code runs? - ``` + ```js let answerToLife = ((4 + 1) * 2 * 4) + 2; ``` @@ -994,7 +1012,7 @@

characters

Arrays let us keep multiple values together in a single collection - ``` + ```js let synonyms = ["plethora", "array", "cornucopia"]; ``` @@ -1060,11 +1078,15 @@

characters

What do you think each of these does? (Try it!) - `["c", "a", "d", "b"].sort()` + ```js + ["c", "a", "d", "b"].sort() + ``` - ["lions", "tigers", "bears oh my!"].join(" & ") +
["lions", "tigers", "bears oh my!"].join(" & ")
- `[1, 2, 3].concat([4, 5, 6])` + ```js + [1, 2, 3].concat([4, 5, 6]) + ``` -- @@ -1090,11 +1112,13 @@

characters

```js let abcArray = ["a", "b", "c"]; abcArray[1] = "d"; + abcArray; ``` ```js let abcString = "abc"; abcString[1] = "d"; + abcString; ``` -- @@ -1112,11 +1136,13 @@

characters

```js let numbers1 = [1, 2, 3]; let result1 = numbers1.push(4); + numbers1; ``` ```js let numbers2 = [1, 2, 3]; let result2 = numbers2.concat([4]); + numbers2; ``` -- @@ -1143,7 +1169,7 @@

characters

```js const constVariable = "original value"; constVariable = "new Value"; - + ``` -- @@ -1200,17 +1226,27 @@

characters

### Getting property values - `js.name` + ```js + js.name + ``` + + + ```js + js.isAwesome + ``` - `js.isAwesome` -- ### Using property values - `js.name.startsWith("Java")` + ```js + js.name.startsWith("Java") + ``` - `let age = 2022 - js.birthYear;` + ```js + let age = 2022 - js.birthYear; + ``` -- @@ -1225,7 +1261,7 @@

characters

indecisive.snack = "chips"; ``` - --- + -- ### Exercise @@ -1244,7 +1280,7 @@

characters

}; ``` - --- + -- ### Nested objects @@ -1359,6 +1395,7 @@

characters

console.log(hello.length); const yello = hello.toUpperCase(); ``` + [✨MDN✨ JS > Standard built-in objects > String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) -- @@ -1420,14 +1457,7 @@

characters

plugins: [ RevealMarkdown, RevealHighlight, RevealNotes, CopyCode ] }); - - - // // Set selector for Klipse interactive snippets - // window.klipse_settings = { - // selector_eval_js: '.eval-js', // css selector for the html elements you want to klipsify - // }; - diff --git a/1-tictactoe.html b/1-tictactoe.html index 3c8fcb0..498f165 100644 --- a/1-tictactoe.html +++ b/1-tictactoe.html @@ -14,8 +14,8 @@ margin: 1em auto; } #board { - max-width: 40%; - margin: 0px auto; + max-width: 50%; + margin: 1em auto; display:grid; grid-template-columns: 1fr 1fr 1fr; grid-template-rows: 1fr 1fr 1fr; @@ -23,7 +23,8 @@ background-color: teal; } .square { - padding-top: 100%; + min-height: 1.3em; + text-align: center; background-color: white; font-size: 5rem; font-family: monospace; diff --git a/2-jsquiz.html b/2-jsquiz-fancy.html similarity index 64% rename from 2-jsquiz.html rename to 2-jsquiz-fancy.html index c81c328..3a05346 100644 --- a/2-jsquiz.html +++ b/2-jsquiz-fancy.html @@ -75,26 +75,24 @@

Quiz.js

- + - - + diff --git a/2-jsquiz-starter.html b/2-jsquiz-starter.html new file mode 100644 index 0000000..ce5c87c --- /dev/null +++ b/2-jsquiz-starter.html @@ -0,0 +1,124 @@ + + + + + Quiz.js + + + +
+

Quiz.js

+

Do you know JS? Find out!

+
+ +
+
+ +
+ +
+ + +
+ +
+ +
+ +
+ + + + + diff --git a/2-slides.html b/2-slides.html index d0b63d7..a3702b7 100644 --- a/2-slides.html +++ b/2-slides.html @@ -23,210 +23,1494 @@
- -
+
-
+
-
+
-
-
-
-
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
-
+
+
+
-
-
- -
-
- -
-
-
+ - Go to [2-jsquiz-starter.html](./2-jsquiz-starter.html) + - Save the HTML file (Right click > "Save file as...") + - Open it in your text editor of choice - - + -- + + ### Where in the HTML doc does our JS live? + + -- + + ### `script` element + + MDN: [HTML > script](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script) + + -- + + What is all this about? + + ```js + // TODO some instructions here + ``` + + -- + + ### comments + + Start with `//` + + Help others (and yourself) understand your code + + Help keep track of things you want to do + + -- + + We'll gradually work through these TODOs to make our own quiz! + + -- + + ### Exercise + + Follow the first 3 `TODO` comments to review skills we've covered so far: + - declare `statement`, `optionButtons`, and `explanation` variables with their corresponding element(s) + - create a `facts` object representing one true/false fact you've learned about JS + - use the `statement` element to display your fact + + + +
+ +
+
+ +
+
+ +
+ +
+ +
+
+ +
+
+ +
+ + + + + + + + + diff --git a/3-doggofetch-finished.html b/3-doggofetch-finished.html new file mode 100644 index 0000000..7a64c5e --- /dev/null +++ b/3-doggofetch-finished.html @@ -0,0 +1,199 @@ + + + + + Doggo Fetch + + + +
+

Guess the Doggo

+

What breed is the dog in this image?

+ +
+ +
+
+
+
+
+ +
+ + + + + + diff --git a/3-doggofetch-starter.html b/3-doggofetch-starter.html new file mode 100644 index 0000000..96b31b4 --- /dev/null +++ b/3-doggofetch-starter.html @@ -0,0 +1,181 @@ + + + + + Doggo Fetch + + + +
+

Guess the Doggo

+

What breed is the dog in this image?

+ +
+ +
+
+
+
+
+ +
+ + + + + + diff --git a/3-doggofetch.html b/3-doggofetch.html deleted file mode 100644 index 459b25e..0000000 --- a/3-doggofetch.html +++ /dev/null @@ -1,199 +0,0 @@ - - - - - Doggo Fetch - - - -
-

Guess the Doggo

-

What breed is the dog in this image?

- -
- -
-
- Fetching doggo... -
-
-
- -
- - - - - - - - - diff --git a/3-slides.html b/3-slides.html index 82f3e8a..c1630a2 100644 --- a/3-slides.html +++ b/3-slides.html @@ -24,30 +24,198 @@
+
+ +
+
+ +
+
@@ -55,11 +223,107 @@ + +
@@ -67,52 +331,388 @@
+
@@ -120,8 +720,8 @@ ## Next steps - Dig deeper with more FrontendMasters courses - - Refine your mental model with [Just JavaScript]() by Dan Abramov and Maggie Appleton - - Explore & investigate on [MDN](developer.mozilla.org) + - Refine your mental model with [Just JavaScript](https://justjavascript.com/) by Dan Abramov and Maggie Appleton + - Explore & investigate on [MDN](developer.mozilla.org) & elsewhere - Keep tinkering!
@@ -144,19 +744,23 @@ + + + diff --git a/README.md b/README.md index 037e3ac..96377b8 100644 --- a/README.md +++ b/README.md @@ -5,9 +5,9 @@ Contents: - Day 1: - [Slides](./1-slides.html) - [Tic Tac Toe](./1-tictactoe.html) -- Day 2: *No spoilers!* - - Slides - - JS Quiz +- Day 2: + - [Slides](./2-slides.html) + - JS Quiz ([starter](./2-jsquiz-starter.html), [finished](./2-jsquiz-finished.html), [fancy](./2-jsquiz-fancy)) - Day 3: *No spoilers!* - Slides - Doggo Fetch @@ -53,27 +53,26 @@ Prerequisites: - 1000: JavaScript: What? Why? How? - 1015: Working with the DOM (HTML) - 1115: Data Types - - 1130: Working with Strings - 1200: Lunch - - 1300: Operators & Expressions - - 1330: Variables - - 1400: Working with Objects & Arrays - - 1530: Day 1 project review + - 1300: Working with Strings + - 1330: Operators & Expressions + - 1500: Variables - 1600: End of Day 1 - Day 2 - - 0930: Day 2 Intro & project overview - - 1000: Working with a code editor - - 1030: Functions & Scope - - 1130: Event Handlers + - 0930: Working with Objects & Arrays + - 1100: Day 1 project review + - 1130: Day 2 project overview + - 1145: Working with a code editor - 1200: Lunch - - 1300: Conditionals - - 1330: Loops - - 1430: Map & Filter - - 1530: Day 2 project review + - 1300: Functions & Scope + - 1415: Event Handlers + - 1500: Conditionals + - 1530: Loops - 1600: End of Day 2 - Day 3 - 0930: Day 3 Intro & project overview - 1000: Fetch, Promises, Async/Await + - 1100: Map & Filter - 1130: Destructuring & spread syntax - 1200: Lunch - 1300: Debugging & error handling diff --git a/jsquiz-wip/2-jsquiz-1.html b/jsquiz-wip/2-jsquiz-1.html new file mode 100644 index 0000000..eb834b9 --- /dev/null +++ b/jsquiz-wip/2-jsquiz-1.html @@ -0,0 +1,127 @@ + + + + + Quiz.js + + + +
+

Quiz.js

+

Do you know JS? Find out!

+
+ +
+
+ +
+ +
+ + +
+ +
+ +
+ +
+ + + + + diff --git a/jsquiz-wip/2-jsquiz-2.html b/jsquiz-wip/2-jsquiz-2.html new file mode 100644 index 0000000..539a328 --- /dev/null +++ b/jsquiz-wip/2-jsquiz-2.html @@ -0,0 +1,131 @@ + + + + + Quiz.js + + + +
+

Quiz.js

+

Do you know JS? Find out!

+
+ +
+
+ +
+ +
+ + +
+ +
+ +
+ +
+ + + + + diff --git a/jsquiz-wip/2-jsquiz-3.html b/jsquiz-wip/2-jsquiz-3.html new file mode 100644 index 0000000..480a493 --- /dev/null +++ b/jsquiz-wip/2-jsquiz-3.html @@ -0,0 +1,131 @@ + + + + + Quiz.js + + + +
+

Quiz.js

+

Do you know JS? Find out!

+
+ +
+
+ +
+ +
+ + +
+ +
+ +
+ +
+ + + + + diff --git a/jsquiz-wip/2-jsquiz-4.html b/jsquiz-wip/2-jsquiz-4.html new file mode 100644 index 0000000..d0a7e61 --- /dev/null +++ b/jsquiz-wip/2-jsquiz-4.html @@ -0,0 +1,136 @@ + + + + + Quiz.js + + + +
+

Quiz.js

+

Do you know JS? Find out!

+
+ +
+
+ +
+ +
+ + +
+ +
+ +
+ +
+ + + + + diff --git a/jsquiz-wip/2-jsquiz-5.html b/jsquiz-wip/2-jsquiz-5.html new file mode 100644 index 0000000..54f0537 --- /dev/null +++ b/jsquiz-wip/2-jsquiz-5.html @@ -0,0 +1,137 @@ + + + + + Quiz.js + + + +
+

Quiz.js

+

Do you know JS? Find out!

+
+ +
+
+ +
+ +
+ + +
+ +
+ +
+ +
+ + + + + diff --git a/jsquiz-wip/2-jsquiz-6.html b/jsquiz-wip/2-jsquiz-6.html new file mode 100644 index 0000000..bba5a68 --- /dev/null +++ b/jsquiz-wip/2-jsquiz-6.html @@ -0,0 +1,141 @@ + + + + + Quiz.js + + + +
+

Quiz.js

+

Do you know JS? Find out!

+
+ +
+
+ +
+ +
+ + +
+ +
+ +
+ +
+ + + + + diff --git a/jsquiz-wip/2-jsquiz-7.html b/jsquiz-wip/2-jsquiz-7.html new file mode 100644 index 0000000..7ea4fd7 --- /dev/null +++ b/jsquiz-wip/2-jsquiz-7.html @@ -0,0 +1,143 @@ + + + + + Quiz.js + + + +
+

Quiz.js

+

Do you know JS? Find out!

+
+ +
+
+ +
+ +
+ + +
+ +
+ +
+ +
+ + + + +