Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit db4d0de

Browse files
committed
fixes
1 parent 3623a88 commit db4d0de

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

‎1-js/02-first-steps/09-alert-prompt-confirm/article.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Interaction: alert, prompt, confirm
22

3-
This part of the tutorial aims to cover JavaScript "as is", without environment-specific tweaks.
3+
In this part of the tutorial we cover JavaScript language "as is", without environment-specific tweaks.
44

55
But we'll still be using the browser as our demo environment, so we should know at least a few of its user-interface functions. In this chapter, we'll get familiar with the browser functions `alert`, `prompt` and `confirm`.
66

‎1-js/02-first-steps/10-ifelse/article.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Sometimes, we need to perform different actions based on different conditions.
44

5-
To do that, we use the `if` statement and the conditional (ternary) operator which we will be referring to as the "question mark" operator`?` for simplicity.
5+
To do that, we can use the `if` statement and the conditional operator `?`, that's also called a "question mark" operator.
66

77
## The "if" statement
88

@@ -103,7 +103,7 @@ In the code above, JavaScript first checks `year < 2015`. If that is falsy, it g
103103

104104
There can be more `else if` blocks. The final `else` is optional.
105105

106-
## Ternary operator '?'
106+
## Conditional operator '?'
107107

108108
Sometimes, we need to assign a variable depending on a condition.
109109

@@ -124,9 +124,9 @@ if (age > 18) {
124124
alert(accessAllowed);
125125
```
126126

127-
The so-called "ternary" or "question mark" operator lets us do that in a shorter and simpler way.
127+
The so-called "conditional" or "question mark" operator lets us do that in a shorter and simpler way.
128128

129-
The operator is represented by a question mark `?`. The formal term "ternary" means that the operator has three operands. It is actually the one and only operator in JavaScript which has that many.
129+
The operator is represented by a question mark `?`. Sometimes it's called "ternary", because the operator has three operands. It is actually the one and only operator in JavaScript which has that many.
130130

131131
The syntax is:
132132
```js
@@ -141,7 +141,7 @@ For example:
141141
let accessAllowed = (age > 18) ? true : false;
142142
```
143143

144-
Technically, we can omit the parentheses around `age > 18`. The question mark operator has a low precedence, so it executes after the comparison `>`.
144+
Technically, we can omit the parentheses around `age > 18`. The question mark operator has a low precedence, so it executes after the comparison `>`.
145145

146146
This example will do the same thing as the previous one:
147147

‎1-js/02-first-steps/11-logical-operators/article.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ The OR `||` operator does the following:
8484

8585
A value is returned in its original form, without the conversion.
8686

87-
In other words, a chain of OR `"||"` returns the first truthy value or the last one if no such value is found.
87+
In other words, a chain of OR `"||"` returns the first truthy value or the last one if no truthy value is found.
8888

8989
For instance:
9090

@@ -101,7 +101,7 @@ This leads to some interesting usage compared to a "pure, classical, boolean-onl
101101

102102
1. **Getting the first truthy value from a list of variables or expressions.**
103103

104-
Imagine we have several variables which can either contain data or be `null/undefined`. How can we find the first one with data?
104+
Imagine we have a list of variables which can either contain data or be `null/undefined`. How can we find the first one with data?
105105

106106
We can use OR `||`:
107107

@@ -143,7 +143,7 @@ This leads to some interesting usage compared to a "pure, classical, boolean-onl
143143
alert(x); // 1
144144
```
145145

146-
An assignment is a simple case. Otherside effects can also be involved.
146+
An assignment is a simple case. There may be side effects, that won't show up if the evaluation doesn't reach them.
147147

148148
As we can see, such a use case is a "shorter way of doing `if`". The first operand is converted to boolean. If it's false, the second one is evaluated.
149149

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /