Skip to content

Commit

Permalink
corrected typos
Browse files Browse the repository at this point in the history
  • Loading branch information
Chandan Rai committed Jul 27, 2017
1 parent 00844b6 commit 278aaa1
Show file tree
Hide file tree
Showing 25 changed files with 71 additions and 71 deletions.
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ First off, thank you for considering contributing to this project. Any help woul

Please feel free to improve the quality of this content by submitting **pull requests**. A merged PR will make you appear in the contributor list. It will, however, be considered a donation of your work to this project. You are still bound by the conditions of the license, meaning that you are not considered an author or owner of the content once it has been merged in.

You may also open **issues** for pointing out mistakes or suggestings ideas.
You may also open **issues** for pointing out mistakes or suggesting ideas.

## Support (or lack thereof)

Please do *not* use issues to ask for help because you're stuck in an exercise or a project. Unfortunately, I don't have enough free time to answer individual requests, so these issues would be closed immediatly.
Please do *not* use issues to ask for help because you're stuck in an exercise or a project. Unfortunately, I don't have enough free time to answer individual requests, so these issues would be closed immediately.

Instead, start by searching the web and ask your questions on programming forums like [Stack Overflow](https://stackoverflow.com) or [Reddit](https://www.reddit.com/r/learnjavascript/). Knowing how to find answers online is a key skill for a developer!

Expand Down
6 changes: 3 additions & 3 deletions manuscript/appendix01.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The safest bet is to choose either Google Chrome or Mozilla Firefox, two "evergr

Maybe you're a little bit of the impatient type, or maybe you'd rather not set up your local machine right now. Fortunately, one of the beauties of JavaScript is that it can run on almost any browser. All you'll need in addition is an active Internet connection.

Coding online requires a **JavaScript playground**, an online service where you can type some JavaScript code and immediatly visualize its result.
Coding online requires a **JavaScript playground**, an online service where you can type some JavaScript code and immediately visualize its result.

### For chapters 1 to 23: CodePen

Expand All @@ -32,7 +32,7 @@ You should use a pen (not necessarily saved) to try every code sample this book
### From chapter 24 onwards: Glitch

Starting with chapter 24, a **back-end** playground will be necessary to create Node.js applications. The prominent choice is [Giltch](https://glitch.com), a platform for quickly building Node-based web applications. Glitch emulates a local Node setup and automates things like code execution, package management, hosting and deployment. You can also remix (clone) any Glitch app to personalize it for your needs.
Starting with chapter 24, a **back-end** playground will be necessary to create Node.js applications. The prominent choice is [Glitch](https://glitch.com), a platform for quickly building Node-based web applications. Glitch emulates a local Node setup and automates things like code execution, package management, hosting and deployment. You can also remix (clone) any Glitch app to personalize it for your needs.

![The Glitch logo](images/appendix01-02.png)

Expand Down Expand Up @@ -120,7 +120,7 @@ For examples and each exercise of a chapter, create an HTML file in the `html` s

This `<script>` tag asks the browser to load the `examples.js` JavaScript file, located at path `../js/examples.js`. The two dots (`..`) at the beginning of the path indicate you're going back one level in the directory structure relative to the HTML file itself before looking in the `js` subfolder for a file named `examples.js`.

Next, open the HTML file in your browser to execute the JavaScript code stored in the `.js` file. Its result will be shown in the browser console (see bolow).
Next, open the HTML file in your browser to execute the JavaScript code stored in the `.js` file. Its result will be shown in the browser console (see below).

#### From chapter 24 onwards

Expand Down
4 changes: 2 additions & 2 deletions manuscript/appendix02.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Here are the coding rules and principles used throughout the book.

> This chapter is by nature subjective and opiniated. Feel free to make your own choices.
> This chapter is by nature subjective and opinionated. Feel free to make your own choices.
## Naming

Expand Down Expand Up @@ -48,7 +48,7 @@ Fortunately, specialized tools called **linters** can check your code against ru

This book uses [ESLint](http://eslint.org) for linting code. ESLint is a very flexible tool and you can tailor it to your specific needs. Different set of ESLint rules have emerged, notably one based on the popular [AirBnb Style Guide](https://github.com/airbnb/javascript).

> This opiniated style guide is well worth a read.
> This opinionated style guide is well worth a read.
This book's ESLint configuration extends the AirBnb and Prettier rules (Prettier getting the precedence), with a few minor deviations.

Expand Down
2 changes: 1 addition & 1 deletion manuscript/chapter02.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ In the following example, lines 2 and 3 each increase the value of variable b b
```js
let b = 0; // b contains 0
b += 1; // b contains 1
b++; // b conttains 2
b++; // b contains 2
console.log(b); // Shows 2
```

Expand Down
14 changes: 7 additions & 7 deletions manuscript/chapter03.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ if (condition) {
}
```

* The code block associated to an `if` is delimited by a pair of opening and closing braces. To improve lisibility, its statements are generally **indented** (shifted to the right).
* The code block associated to an `if` is delimited by a pair of opening and closing braces. To improve visibility, its statements are generally **indented** (shifted to the right).

* The **comparison operators** `===`, `!==`, `<`, `<=`, `>` et `>=` are used to compare numbers inside a condition. All of them return a boolean result.

* An `else` statement can be associated to an `if` to express an **alternative**. Depending on the condition value, either the code block associated to the `if` or the one associated to the `else` will be run, but never both. Thre is no limit to the depth of condition nesting.
* An `else` statement can be associated to an `if` to express an **alternative**. Depending on the condition value, either the code block associated to the `if` or the one associated to the `else` will be run, but never both. There is no limit to the depth of condition nesting.

```js
if (condition) {
Expand Down Expand Up @@ -173,7 +173,7 @@ if (number > 0) {
} else {
// number <= 0
if (number < 0) {
console.log(`${number} is nagative`);
console.log(`${number} is negative`);
} else {
// number === 0
console.log(`${number} is zero`);
Expand All @@ -189,7 +189,7 @@ The execution flow for the previous program can be expressed graphically using a

![Example flow diagram](images/chapter03-01.png)

This example shows how essential indentation is for understanding a program's flow. There is no limit to the possible depth of condition nesting, but too many will affect program lisibility.
This example shows how essential indentation is for understanding a program's flow. There is no limit to the possible depth of condition nesting, but too many will affect program visibility.

A particular case happens when the only statement in a `else` block is an `if`. In that case, you can write this `else` on the same line as the `if` and without braces. Here's a more concise way to write our example program.

Expand Down Expand Up @@ -220,7 +220,7 @@ if ((number >= 0) && (number <= 100)) {
}
```

I> Parentheses between sub-conditions are not mandatory but I advise you to add them anyway, to avoir nasty bugs in some special cases.
I> Parentheses between sub-conditions are not mandatory but I advise you to add them anyway, to avoid nasty bugs in some special cases.

The `&&` operator ("logical and") can apply to both types of boolean values. `true` will only be the result of the statement if both conditions are true.

Expand Down Expand Up @@ -389,7 +389,7 @@ if (nb1 > nb2) {
console.log(nb1, nb2, nb3);
```

Before executing it, try to guess the final values of variables `nb1`, `nb2` and `nb3` depeding on their initial values. Complete the following table.
Before executing it, try to guess the final values of variables `nb1`, `nb2` and `nb3` depending on their initial values. Complete the following table.

|Initial values |`nb1` final value |`nb2` final value|`nb3` final value|
|---------------------|------------------|-----------------|-----------------|
Expand All @@ -405,7 +405,7 @@ Write a program that accepts a month number (between 1 and 12), then shows the n

### Following second

Write a program that asks for a time under the form of three informations (hours, minutes, seconds). The program calculates and shows the time one second after. Incorrect inputs must be taken into account.
Write a program that asks for a time under the form of three information (hours, minutes, seconds). The program calculates and shows the time one second after. Incorrect inputs must be taken into account.

> This is not as simple as it seems... Look at the following results to see for yourself:
>
Expand Down
2 changes: 1 addition & 1 deletion manuscript/chapter04.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ When it's done, improve it so that the number of turns is given by the user.

### Parity

Check the following program that shows even number (divisibles by 2) between 1 and 10.
Check the following program that shows even number (divisible by 2) between 1 and 10.

```js
for (let i = 1; i <= 10; i++) {
Expand Down
4 changes: 2 additions & 2 deletions manuscript/chapter05.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ In this chapter, you'll learn how to break down a program into subparts called f

* A **function** is a group of statements that performs a particular task. JavaScript functions are created using the `function` keyword.

* Written as a combination of several short and focused functions, a program will generally be easier to understand and more **modular** than a monolitic one.
* Written as a combination of several short and focused functions, a program will generally be easier to understand and more **modular** than a monolithic one.

* A **function call** triggers the execution of the function code. After it's done, execution resumes at the place where the call was made.

Expand Down Expand Up @@ -162,7 +162,7 @@ Calling a function triggers the execution of actions listed therein (the code in

### Usefulness of functions

A complex problem is generally more manageable when broken down in simpler subproblems. Computer programs are no exception to this rule. Written as a combination of several short and focused functions, a program will be easier to understand and to update than a monolitic one. As an added bonus, some functions could be reused in other programs!
A complex problem is generally more manageable when broken down in simpler subproblems. Computer programs are no exception to this rule. Written as a combination of several short and focused functions, a program will be easier to understand and to update than a monolithic one. As an added bonus, some functions could be reused in other programs!

Creating functions can also be a solution to the problem of [code duplication](https://en.wikipedia.org/wiki/Duplicate_code): instead of being duplicated at several places, a piece of code is centralized in a function and called from anywhere when needed.

Expand Down
2 changes: 1 addition & 1 deletion manuscript/chapter07.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ for (let i = 0; i < movies.length; i++) {

The `for` loop runs through each element in the array starting with index 0 all the way up to the length of the array minus 1, which will be its last element.

Another way is to call the `forEach()` method on the array. It takes as a paramater a **function** that will be applied to each array element.
Another way is to call the `forEach()` method on the array. It takes as a parameter a **function** that will be applied to each array element.

```js
myArray.forEach(myElement => {
Expand Down
2 changes: 1 addition & 1 deletion manuscript/chapter08.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Let's recapitulate what we already know about strings:

* The `+` operator concatenates (combines or adds) two or more strings.

Beyond these basic uses, strings have even more versatilty.
Beyond these basic uses, strings have even more versatility.

## Obtaining string length

Expand Down
4 changes: 2 additions & 2 deletions manuscript/chapter09.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ This type of relationship between JavaScript objects is called **delegation**: a

In *class-based* object-oriented languages like C++, Java and C#, classes are static **blueprints** (templates). When a object is created, the methods and properties of the class are copied into a new entity, called an **instance**. After instantiation, the newly created object has no relation whatsoever with its class.

JavaScript's object-oriented model is based on prototypes, *not* classes, to share properties and delegate behavior between objects. In JavaScript, a class is itself an object, not a static blueprint. "Instanciating" a class creates a new object linked to a prototype object. Regarding classes behavior, the JavaScript language is quite different from C++, Java or C#, but close to other object-oriented languages like Python, Ruby and Smalltalk.
JavaScript's object-oriented model is based on prototypes, *not* classes, to share properties and delegate behavior between objects. In JavaScript, a class is itself an object, not a static blueprint. "Instantiating" a class creates a new object linked to a prototype object. Regarding classes behavior, the JavaScript language is quite different from C++, Java or C#, but close to other object-oriented languages like Python, Ruby and Smalltalk.

The JavaScript `class` syntax is merely a more convenient way to create relationships between objects through prototypes. Classes were introduced to emulate the class-based OOP model on top of JavaScript's own prototype-based model. It's an example of what programmers call [syntactic sugar](https://en.wikipedia.org/wiki/Syntactic_sugar).

Expand Down Expand Up @@ -350,7 +350,7 @@ Improve the example RPG to add character inventory management according to the f

* The character description must show the inventory state.

* When a character slays annother one, the victim's inventory goes to its vanquisher.
* When a character slays another one, the victim's inventory goes to its vanquisher.

Here's the expected execution result.

Expand Down
10 changes: 5 additions & 5 deletions manuscript/chapter10.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ console.log(averageRating);

The previous program is an example of what is called **imperative programming**. In this paradigm, the programmer gives orders to the computer through a series of statements that modify the program state. Imperative programming focuses on describing *how* a program operates.

The concept of state is an important one. The **state** of a program is the value of its **global variables** (variables accessible everythere in the code) at a given time. In our example, the values of `movieList`, `titles`, `nolanMovieCount`, `bestTitles`, `ratingSum` and `averageRating` form the state of the program. Any assignment to one of these variables is a state change, often called a **mutation**.
The concept of state is an important one. The **state** of a program is the value of its **global variables** (variables accessible everywhere in the code) at a given time. In our example, the values of `movieList`, `titles`, `nolanMovieCount`, `bestTitles`, `ratingSum` and `averageRating` form the state of the program. Any assignment to one of these variables is a state change, often called a **mutation**.

In imperative programming, the state can be modified anywhere in the source code. This is convenient, but can also lead to nasty bugs and maintenance headaches. As the program grows in size and complexity, it's becoming easier for the programmer to mutate a part of the state by mistake, and harder to monitor state modifications.

Expand Down Expand Up @@ -344,7 +344,7 @@ The `map()` and `filter()` method can be used together to achieve powerful effec
// Get titles of movies with an IMDB rating greater or equal to 7.5
const bestTitles = movies => {
/* Previous code
onst bestTitles = [];
const bestTitles = [];
for (movie of movies) {
if (movie.imdbRating >= 7.5) {
bestTitles.push(movie.title);
Expand Down Expand Up @@ -379,7 +379,7 @@ The `reduce()` method can take several parameters:

* The second one is the initial value of the accumulator (often 0).

Here's how to apply `reduce()` to caculate the average rating of a movie list.
Here's how to apply `reduce()` to calculate the average rating of a movie list.

```js
// Compute average rating of a movie list
Expand Down Expand Up @@ -434,7 +434,7 @@ We have defined helper functions that we combine to achieve the desired behaviou

## JavaScript: a multi-paradigm language

The JavaScript language is full of paradoxes. It has famously been [invented in ten days](https://www.w3.org/community/webed/wiki/A_Short_History_of_JavaScript), and is now enjoying a popularity almost unique in programming history. Its syntax borrows heavily from maintream imperative languages like C or Java, but its design principles are closer to functional languages like [Scheme](https://en.wikipedia.org/wiki/Scheme_(programming_language)).
The JavaScript language is full of paradoxes. It has famously been [invented in ten days](https://www.w3.org/community/webed/wiki/A_Short_History_of_JavaScript), and is now enjoying a popularity almost unique in programming history. Its syntax borrows heavily from mainstream imperative languages like C or Java, but its design principles are closer to functional languages like [Scheme](https://en.wikipedia.org/wiki/Scheme_(programming_language)).

JavaScript's multi-paradigm nature means you can write imperative, object-oriented or functional code, choosing the right tool for the job and leveraging your previous programming experience. As always, diversity is a source of flexibility and ultimately a strength.

Expand Down Expand Up @@ -505,7 +505,7 @@ Complete the following program to compute and show the names of political forms
const governmentForms = [
{
name: "Plutocracy",
definition: "Rule by the weathly"
definition: "Rule by the wealthy"
},
{
name: "Oligarchy",
Expand Down
2 changes: 1 addition & 1 deletion manuscript/chapter12.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ You can skip this exercise if you have prior experience with HTML and CSS.

### Your first web page

Follow the beginning of the [Getting started with the Web](https://developer.mozilla.org/en-US/docs/Learn/Getting_started_with_the_web) tutorial from Mozilla Develper Network to create a simple web page using HTML and CSS. The required steps are:
Follow the beginning of the [Getting started with the Web](https://developer.mozilla.org/en-US/docs/Learn/Getting_started_with_the_web) tutorial from Mozilla Developer Network to create a simple web page using HTML and CSS. The required steps are:

1. [What will your website look like?](https://developer.mozilla.org/en-US/docs/Learn/Getting_started_with_the_web/What_will_your_website_look_like)
1. [Dealing with files](https://developer.mozilla.org/en-US/docs/Learn/Getting_started_with_the_web/Dealing_with_files)
Expand Down
6 changes: 3 additions & 3 deletions manuscript/chapter13.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This chapter will help you discover how a web page is shown by a browser.

* A **web page** is a structured document containing both text and HTML tags. The **DOM**, or *Document Object Model*, is a standardized way to define a web page's structure.

* Tho DOM is alos an **API** allowing programmatical interactions with the web page. With JavaScript, you can access the structure of a page displayed in a browser and modify it.
* Tho DOM is also an **API** allowing programmatical interactions with the web page. With JavaScript, you can access the structure of a page displayed in a browser and modify it.

* The DOM represents a web page as a hierarchy of **objects**, where each object corresponds to a node in the nested HTML element tree.

Expand Down Expand Up @@ -125,7 +125,7 @@ To eliminate these text nodes between tags, you could have written the HTML page
<body><h1>My web page</h1><!-- ... -->
```

It's better, however, to take the text nodes between tags into accouant than to sacrifice lisibility and code indentation.
It's better, however, to take the text nodes between tags into account than to sacrifice visibility and code indentation.

### Browse child nodes

Expand Down Expand Up @@ -176,7 +176,7 @@ console.log(document.parentNode); // Will show null, since body has no parent no

Your mission here is to create a `showChild()` function that shows one a of children of an DOM element node. This function takes as parameter the parent node and the child node index. Error cases like non-element node or out-of-limits index must be taken into account.

Here'e the associated HTML code.
Here's the associated HTML code.

```html
<h1>A title</h1>
Expand Down
Loading

0 comments on commit 278aaa1

Please sign in to comment.