Skip to content

Commit 8c488d5

Browse files
committed
kriszta feedback
1 parent f476157 commit 8c488d5

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

js/lesson2/tutorial.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,7 @@ console.log('Apples and oranges are different: ' + notEqual);
137137
```
138138

139139
> You may also see `==` and `!=`, these are similar but have some quirks so it's generally recommended to avoid them.
140-
> You can simply use `===` and `!==` and they will
141-
> always do what you expect.
140+
> It is safer to use `===` and `!==` as they will always do what you expect.
142141
143142
The `>` and `<` operators are "greater than" and "less than". You can
144143
use them to tell which of two numbers is bigger.
@@ -155,7 +154,7 @@ var lessStudents = students < pizzas;
155154
console.log('Are there fewer students than pizzas?' + lessStudents);
156155

157156
```
158-
> Play around with changing the `coaches`, `students` and `pizzas` variable numbers to familiarise yourself with it more.
157+
> Play around with changing the `coaches`, `students` and `pizzas` variable numbers to familiarise yourself with operators.
159158
160159
You can also combine operators.
161160

@@ -210,9 +209,15 @@ if (totalPeople > pizzas) {
210209

211210
#### Ternaries - Additional learning
212211

213-
In the latest versions of JavaScript you may see if/else statements written slighlty differently. We believe teaching the above way first helps cement how they work, however if you're working with a code base that uses the latest JavaScript you will see it written this way.
212+
You may also see if/else statements written slightly differently.
214213

215-
The condition followed by a question mark (?), then an expression to execute if the condition is truthy followed by a colon (:) and finally the expression to execute if the condition is falsy. For example:
214+
The condition followed by a question mark (?), then an expression to execute if the condition is truthy followed by a colon (:) and finally the expression to execute if the condition is falsy.
215+
216+
```js
217+
condition ? expression1 : expression2
218+
```
219+
220+
Using the people and pizza example we wrote above and using the Ternary Operator instead of if/else it would look like this:
216221

217222
```js
218223
totalPeople > pizzas
@@ -304,7 +309,7 @@ Even though `while` loops are simpler than `for` loops, it is more common to see
304309

305310
An array is a simple *data structure*. It can hold a list of elements of the same or different types (e.g. strings, numbers, booleans). In an array each element can be accessed using the **index**.
306311

307-
Confusingly, the first index of an array is 0, not 1.
312+
Confusingly, the first index of an array in JavaScript is 0, not 1.
308313

309314
To understand this better, let's create an array of strings.
310315

@@ -319,7 +324,7 @@ To retrieve an item from the array, we use **square bracket notation**
319324

320325
To get the first item `animals[0]`, the second `animals[1]` etc.
321326

322-
> Create an array that includes 5 names and then access the 3rd item in the array? (don't forget to access the third item in the array you won't be doing [3])
327+
> Create an array that includes 5 names and then access the 3rd item in the array. (don't forget to access the third item in the array you won't be doing [3])
323328
324329
### Properties - `length`
325330

0 commit comments

Comments
 (0)