Skip to content

Make minor grammar corrections/updates #1612

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 61 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
ffbb05e
Make minor grammar corrections/updates
jchue Nov 18, 2019
73a8841
Update article.md
paroche Nov 19, 2019
de1b2e1
Update article.md
paroche Nov 19, 2019
1415467
Update article.md
paroche Nov 19, 2019
88abe30
Fix: typos
kvoncode Nov 19, 2019
bbc374c
Fix err in syntax
Nov 23, 2019
6285691
Update article.md
generally23 Nov 24, 2019
49b8c6a
fixed a word 'operational' to be 'operating'
koala-lava Nov 24, 2019
4064535
minor
koala-lava Nov 25, 2019
ddf91b4
Update article.md
dashaezhova Nov 25, 2019
dafd592
minor
koala-lava Nov 25, 2019
a6629b4
modified a sentence
Haggr Nov 10, 2019
a478839
Update article.md
paroche Nov 26, 2019
bfa6eb8
Update article.md
paroche Nov 26, 2019
05cc2be
Update article.md
paroche Nov 26, 2019
71d7eb8
Update task.md
paroche Nov 26, 2019
ceceff8
Update article.md
paroche Nov 27, 2019
be71644
Update article.md
paroche Nov 27, 2019
82e8241
Update index.html
masterashu Nov 26, 2019
e9718cd
Update index.html
masterashu Nov 26, 2019
171c2c2
Update solution.md
masterashu Nov 26, 2019
09f43b9
Update task.md
masterashu Nov 26, 2019
aafa925
minor fixes
iliakan Nov 28, 2019
2b092cd
minor fixes
iliakan Nov 30, 2019
8179220
re-import images (Sketch update)
iliakan Nov 30, 2019
d139c6e
minor
iliakan Nov 30, 2019
c64f64c
minor fixes
iliakan Nov 30, 2019
85fe8c2
Minor note
koala-lava Nov 28, 2019
b6c2422
minor fixes
iliakan Nov 30, 2019
953c136
Update 'Window sizes and scrolling' article.md
dashaezhova Nov 26, 2019
84de893
Consistent HTML for the task source and solution
koala-lava Nov 25, 2019
be53100
consistent CSS for the task and the solution
koala-lava Nov 25, 2019
f0f5703
Update solution.md
spaceinvadev Nov 18, 2019
58a4e55
Update article.md
patternina Nov 20, 2019
845e31a
add consistency
dagolinuxoid Nov 18, 2019
f21262e
Fix small grammar mistake in closure makeArmy task
jakewilson Nov 12, 2019
dcb6273
BigInt Type added in primitive types
ajitsinghkaler Nov 20, 2019
664f7fc
Added new information about bigInt
ajitsinghkaler Nov 22, 2019
125758a
bigint
iliakan Dec 1, 2019
4a8b4de
Update article.md
paroche Dec 1, 2019
e96f886
Update article.md
paroche Dec 1, 2019
344398e
Fix small typo in example comment
spaceinvadev Nov 30, 2019
d37a445
Add a missing word
huyenltnguyen Nov 12, 2019
8c6caa3
Update article.md
paroche Nov 8, 2019
d364def
consistent error output comments
koala-lava Nov 7, 2019
9dff97a
minor fixes
iliakan Dec 1, 2019
a465800
content improvements
iliakan Dec 1, 2019
58c7462
minor fixes
iliakan Dec 1, 2019
ba6f8f3
Added clarification
koala-lava Nov 11, 2019
fef9334
Update solution.md
koala-lava Dec 1, 2019
02c3658
content improvements
iliakan Dec 2, 2019
56bb19b
Update solution.md
CyberMew Dec 2, 2019
5d6e04f
Update article.md
paroche Dec 2, 2019
5fdbe40
Update article.md
CyberMew Dec 2, 2019
ba44712
Update article.md
CyberMew Dec 2, 2019
23f259c
content fixes, #1646
iliakan Dec 2, 2019
7450dbe
fixes #1599
iliakan Dec 2, 2019
c4b6d5d
fixes #1591
iliakan Dec 2, 2019
c300610
closes #1591
iliakan Dec 3, 2019
3f840b7
fixes #1653
iliakan Dec 4, 2019
4a2d496
Make minor grammar corrections/updates to async/callbacks
jchue Dec 7, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions 1-js/01-getting-started/4-devtools/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,15 @@ The exact look of developer tools depends on your version of Chrome. It changes
- Here we can see the red-colored error message. In this case, the script contains an unknown "lalala" command.
- On the right, there is a clickable link to the source `bug.html:12` with the line number where the error has occurred.

Below the error message, there is a blue `>` symbol. It marks a "command line" where we can type JavaScript commands. Press `key:Enter` to run them (`key:Shift+Enter` to input multi-line commands).
Below the error message, there is a blue `>` symbol. It marks a "command line" where we can type JavaScript commands. Press `key:Enter` to run them.

Now we can see errors, and that's enough for a start. We'll come back to developer tools later and cover debugging more in-depth in the chapter <info:debugging-chrome>.

```smart header="Multi-line input"
Usually, when we put a line of code into the console, and then press `key:Enter`, it executes.

To insert multiple lines, press `key:Shift+Enter`. This way one can enter long fragments of JavaScript code.
```

## Firefox, Edge, and others

Expand All @@ -50,12 +55,6 @@ Open Preferences and go to the "Advanced" pane. There's a checkbox at the bottom

Now `key:Cmd+Opt+C` can toggle the console. Also, note that the new top menu item named "Develop" has appeared. It has many commands and options.

```smart header="Multi-line input"
Usually, when we put a line of code into the console, and then press `key:Enter`, it executes.

To insert multiple lines, press `key:Shift+Enter`. This way one can enter long fragments of JavaScript code.
```

## Summary

- Developer tools allow us to see errors, run commands, examine variables, and much more.
Expand Down
2 changes: 1 addition & 1 deletion 1-js/02-first-steps/03-strict-mode/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Only comments may appear above `"use strict"`.
```warn header="There's no way to cancel `use strict`"
There is no directive like `"no use strict"` that reverts the engine to old behavior.

Once we enter strict mode, there's no return.
Once we enter strict mode, there's no going back.
```

## Browser console
Expand Down
41 changes: 31 additions & 10 deletions 1-js/02-first-steps/05-types/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ message = 123456;

Programming languages that allow such things are called "dynamically typed", meaning that there are data types, but variables are not bound to any of them.

There are seven basic data types in JavaScript. Here, we'll cover them in general and in the next chapters we'll talk about each of them in detail.
There are eight basic data types in JavaScript. Here, we'll cover them in general and in the next chapters we'll talk about each of them in detail.

## A number
## Number

```js
let n = 123;
Expand Down Expand Up @@ -62,14 +62,33 @@ Special numeric values formally belong to the "number" type. Of course they are

We'll see more about working with numbers in the chapter <info:number>.

## A string
## BigInt

In JavaScript, the "number" type cannot represent integer values larger than <code>2<sup>53</sup></code> (or less than <code>-2<sup>53</sup></code> for negatives), that's a technical limitation caused by their internal representation. That's about 16 decimal digits, so for most purposes the limitation isn't a problem, but sometimes we need really big numbers, e.g. for cryptography or microsecond-precision timestamps.

`BigInt` type was recently added to the language to represent integers of arbitrary length.

A `BigInt` is created by appending `n` to the end of an integer literal:

```js
// the "n" at the end means it's a BigInt
const bigInt = 1234567890123456789012345678901234567890n;
```

As `BigInt` numbers are rarely needed, we devoted them a separate chapter <info:bigint>.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest "we devoted a separate chapter to them...". (as is is ungrammatical).


```smart header="Compatability issues"
Right now `BigInt` is supported in Firefox and Chrome, but not in Safari/IE/Edge.
```

## String

A string in JavaScript must be surrounded by quotes.

```js
let str = "Hello";
let str2 = 'Single quotes are ok too';
let phrase = `can embed ${str}`;
let phrase = `can embed another ${str}`;
```

In JavaScript, there are 3 types of quotes.
Expand All @@ -78,7 +97,7 @@ In JavaScript, there are 3 types of quotes.
2. Single quotes: `'Hello'`.
3. Backticks: <code>&#96;Hello&#96;</code>.

Double and single quotes are "simple" quotes. There's no difference between them in JavaScript.
Double and single quotes are "simple" quotes. There's practically no difference between them in JavaScript.

Backticks are "extended functionality" quotes. They allow us to embed variables and expressions into a string by wrapping them in `${…}`, for example:

Expand All @@ -102,12 +121,12 @@ alert( "the result is ${1 + 2}" ); // the result is ${1 + 2} (double quotes do n
We'll cover strings more thoroughly in the chapter <info:string>.

```smart header="There is no *character* type."
In some languages, there is a special "character" type for a single character. For example, in the C language and in Java it is `char`.
In some languages, there is a special "character" type for a single character. For example, in the C language and in Java it is called "char".

In JavaScript, there is no such type. There's only one type: `string`. A string may consist of only one character or many of them.
```

## A boolean (logical type)
## Boolean (logical type)

The boolean type has only two values: `true` and `false`.

Expand Down Expand Up @@ -198,6 +217,8 @@ typeof undefined // "undefined"

typeof 0 // "number"

typeof 10n // "bigint"

typeof true // "boolean"

typeof "foo" // "string"
Expand All @@ -223,12 +244,12 @@ The last three lines may need additional explanation:
2. The result of `typeof null` is `"object"`. That's wrong. It is an officially recognized error in `typeof`, kept for compatibility. Of course, `null` is not an object. It is a special value with a separate type of its own. So, again, this is an error in the language.
3. The result of `typeof alert` is `"function"`, because `alert` is a function. We'll study functions in the next chapters where we'll also see that there's no special "function" type in JavaScript. Functions belong to the object type. But `typeof` treats them differently, returning `"function"`. That's not quite correct, but very convenient in practice.


## Summary

There are 7 basic data types in JavaScript.
There are 8 basic data types in JavaScript.

- `number` for numbers of any kind: integer or floating-point.
- `number` for numbers of any kind: integer or floating-point, integers are limited by ±2<sup>53</sup>.
- `bigint` is for integer numbers of arbitrary length.
- `string` for strings. A string may have one or more characters, there's no separate single-character type.
- `boolean` for `true`/`false`.
- `null` for unknown values -- a standalone type that has a single value `null`.
Expand Down
15 changes: 2 additions & 13 deletions 1-js/02-first-steps/06-type-conversions/article.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Type Conversions

Most of the time, operators and functions automatically convert the values given to them to the right type.
Most of the time, operators and functions automatically convert the values given to them to the right type.

For example, `alert` automatically converts any value to a string to show it. Mathematical operations convert values to numbers.

Expand Down Expand Up @@ -81,18 +81,7 @@ alert( Number(false) ); // 0

Please note that `null` and `undefined` behave differently here: `null` becomes zero while `undefined` becomes `NaN`.

````smart header="Addition '+' concatenates strings"
Almost all mathematical operations convert values to numbers. A notable exception is addition `+`. If one of the added values is a string, the other one is also converted to a string.

Then, it concatenates (joins) them:

```js run
alert( 1 + '2' ); // '12' (string to the right)
alert( '1' + 2 ); // '12' (string to the left)
```

This only happens when at least one of the arguments is a string. Otherwise, values are converted to numbers.
````
Most mathematical operators also perform such conversion, we'll see that in the next chapter.

## Boolean Conversion

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ null === +"\n0\n" → false
Some of the reasons:

1. Obviously, true.
2. Dictionary comparison, hence false.
2. Dictionary comparison, hence false. `"a"` is smaller than `"p"`.
3. Again, dictionary comparison, first char of `"2"` is greater than the first char of `"1"`.
4. Values `null` and `undefined` equal each other only.
5. Strict equality is strict. Different types from both sides lead to false.
Expand Down
Loading