Skip to content

Commit a3e0ed2

Browse files
authored
Merge pull request #80 from cdmain/main
Update K-arrays.md
2 parents 9e23761 + da9b339 commit a3e0ed2

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lessons/04-javascript/K-arrays.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ console.log(primeNumbers.length);
3232
console.log(primeNumbers.join(" | "));
3333
```
3434

35-
`primeNumbers.length` gives you back an number that is how long the array is. In this case there are eight elements in the array so it gives us back `8`. `primeNumbers.join(" | "))` takes your whole array and makes it into one string. THe `" | "` paramenter I'm passing is what I want put between each element, so you end up with the string `"1 | 2 | 3 | 5 | 7 | 11 | 13 | 17"`.
35+
`primeNumbers.length` gives you back an number that is how long the array is. In this case there are eight elements in the array so it gives us back `8`. `primeNumbers.join(" | "))` takes your whole array and makes it into one string. The `" | "` paramenter I'm passing is what I want put between each element, so you end up with the string `"1 | 2 | 3 | 5 | 7 | 11 | 13 | 17"`.
3636

3737
So what if I want to add an element to the array after I've created. Use `push`!
3838

lessons/05-putting-it-all-together/A-the-dom.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ const redSquare = document.querySelector(".red-square");
6262
redSquare.style.backgroundColor = "limegreen";
6363
```
6464

65-
Notice that, despite the CSS class dicatating that the `div` should be `crimson` colored, it's actually `limegreen`. This is because we used JavaScript to change the color of it. So let's break it down.
65+
Notice that, despite the CSS class dictating that the `div` should be `crimson` colored, it's actually `limegreen`. This is because we used JavaScript to change the color of it. So let's break it down.
6666

6767
- We called a method on `document`. `document` is a globally available variable in the browser that you use to interact with the HTML and CSS. It a lot of methods that you can use. In this case, we're using the `querySelector` in which you pass in a CSS selector and it returns to you the **first** one of that matches selector that it finds (if you have many of them on the page, you get just the first one.)
6868
- From there, we have a JavaScript pointer to the `div.red-square` tag stored in the `redSquare` variable which means we can start manipulating it.

0 commit comments

Comments
 (0)