Skip to content
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

Update typos, grammer, markdown errors, and readability. #94

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lukecaputo
Copy link

Lots of changes throughout. Most of the changes make the content easier to read (rewording, grammar, typos, etc..). The views and intent of the authors were kept intact.

Lots of changes throughout. Most of the changes make the content easier to read (rewording, grammar, typos, etc..). The authors' views and intents were kept intact.
@@ -1,6 +1,6 @@
# Length

Arrays have a property called length, and it's pretty much exactly as it sounds, it's the length of the array.
Arrays have a property called length, and it's pretty much exactly as it sounds. The length property is the length of the array.
Copy link
Contributor

@Purukitto Purukitto Oct 1, 2020

Choose a reason for hiding this comment

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

I don't think this is required/makes it easier to understand. The original line with the context is explanatory enough

@@ -2,8 +2,8 @@

A condition is a test for something. Conditions are very important for programming, in several ways:

First of all conditions can be used to ensure that your program works, regardless of what data you throw at it for processing. If you blindly trust data, you’ll get into trouble and your programs will fail. If you test that the thing you want to do is possible and has all the required information in the right format, that won’t happen, and your program will be a lot more stable. Taking such precautions is also known as programming defensively.
First of all, conditions can be used to ensure that your program works, regardless of what data you throw at it for processing. If you blindly trust data, you’ll get into trouble and your programs will fail. If you test that the thing you want to do is possible and has all the required information in the right format, that won’t happen, and your program will be much more stable. Taking such precautions is also known as programming defensively.

The other thing conditions can do for you is allow for branching. You might have encountered branching diagrams before, for example when filling out a form. Basically, this refers to executing different “branches” (parts) of code, depending on if the condition is met or not.
Copy link
Contributor

Choose a reason for hiding this comment

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

The other thing conditions can do for you is allow for branching. You might have encountered branching diagrams before, for example when filling out a form. This refers to executing different “branches” (parts) of code, depending on if the condition is met or not. The other thing conditions can do for you is allow for branching. You might have encountered branching diagrams before, for example when filling out a form. This refers to executing different “branches” (parts) of code, depending on if the condition is met or not.

I will suggest this additional change

@@ -8,16 +8,16 @@ if (country === "France") {
}
```

The conditional part is the variable `country` followed by the three equal signs (`===`). Three equal signs tests if the variable `country` has both the correct value (`France`) and also the correct type (`String`). You can test conditions with double equal signs, too, however a conditional such as `if (x == 5)` would then return true for both `var x = 5;` and `var x = "5";`. Depending on what your program is doing, this could make quite a difference. It is highly recommended as a best practice that you always compare equality with three equal signs (`===` and `!==`) instead of two (`==` and `!=`).
The conditional part is the variable `country` followed by the three equal signs (`===`). Three equal signs tests if the variable `country` has both the correct value (`France`) and also the correct type (`String`). You can test conditions with double equal signs, too, however a conditional such as `if (x == 5)` would then return true for both `var x = 5;` and ``var x = '5';``. Depending on what your program is doing, this could make quite a difference. It is highly recommended as a best practice that you always compare equality with three equal signs (`===` and `!==`) instead of two (`==` and `!=`).
Copy link
Contributor

Choose a reason for hiding this comment

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

What was your reason to add another ` in this part?


In JavaScript “or” is written as `||` and “and” is written as `&&`.
In JavaScript, “or” is written as `||` and “and” is written as ``&&``.
Copy link
Contributor

Choose a reason for hiding this comment

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

What was your reason to add another ` in this part?

@@ -20,10 +20,9 @@ if(country === 'England' || country === 'Germany') {
}
```

**Note**: Just like operations on numbers, Condtions can be grouped using parenthesis, ex: ```if ( (name === "John" || name === "Jennifer") && country === "France")```.
Copy link
Contributor

Choose a reason for hiding this comment

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

This note would be helpful


{% exercise %}
Fill up the 2 conditions so that `primaryCategory` equals `"E/J"` only if name equals `"John"` and country is `"England"`, and so that `secondaryCategory` equals `"E|J"` only if name equals `"John"` or country is `"England"`
Fill up the 2 conditions so that primaryCategory equals "E/J" only if name equals "John" and country is "England", and so that secondaryCategory equals "E|J" only if name equals "John" or country is "England".
Copy link
Contributor

Choose a reason for hiding this comment

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

I think retaining the code markdown will make it easier to read

@@ -72,7 +69,7 @@ process_double([5,6,7]) // => [10, 12, 14]


Let's look at another example.
We'll create a function called `buildMultiplier` that takes a number `x` as input and returns a function that multiplies its argument by `x` :
We'll create a function called `buildMultiplier` that takes a number (`x`) as input and returns a function that multiplies its argument by that number:
Copy link
Contributor

Choose a reason for hiding this comment

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

The parenthesis are not necessary as a code block was used



{% exercise %}
Using a for-loop, create a variable named `message` that equals the concatenation of integers (0, 1, 2, ...) from 0 to 99.
Using a for loop, create a variable named message that equals the concatenation of integers (0, 1, 2, ...) from 0 to 99.
Copy link
Contributor

Choose a reason for hiding this comment

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

Keeping the code block syntax for variables is better (message)


```javascript
while(condition){
// do it as long as condition is true
}
```

For example, the loop in this example will repetitively execute its block of code as long as the variable i is less than 5:
For example, the loop in the code below will repetitively execute as long as the variable i is less than 5:
Copy link
Contributor

Choose a reason for hiding this comment

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

repetitively execute as

Execute what?

@@ -31,7 +31,7 @@ do {


{% exercise %}
Using a while-loop, create a variable named `message` that equals the concatenation of integers (0, 1, 2, ...) as long as its length (`message.length`) is less than 100.
Using a while-loop, create a variable named message that equals the concatenation of integers (0, 1, 2, ...) as long as its length (message.length) is less than 100.
Copy link
Contributor

Choose a reason for hiding this comment

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

Keeping the code block syntax for variables is better (message)

@@ -1,19 +1,19 @@
# Creation
There are two ways to create an `object` in JavaScript:
There are two ways to create an `object` in JavaScript.
Copy link
Contributor

Choose a reason for hiding this comment

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

The ':' makes more sense in this context

```js
var adult = {age:26},
child = Object.create(adult);
child.age = 8;

delete child.age;
/* Remove age property from child, revealing the age of the prototype, because then it is not overriden. */
/* Remove age property from child, revealing the age of the prototype,
because then it is not overriden. */
Copy link
Contributor

Choose a reason for hiding this comment

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

why the line break?

@@ -1,5 +1,5 @@
# Global footprint
If you are developing a module, which might be running on a web page, which also runs other modules, then you must beware the variable name overlapping.
If you are developing a module runs on a web page and also runs other modules, then you must be aware the variable name overlapping.
Copy link
Contributor

Choose a reason for hiding this comment

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

a module runs on a

a module that runs on a

must be aware the variable name overlapping.

must be vary of variable name overlapping.

@@ -1,5 +1,6 @@
# Properties
Object's property is a `propertyName`: `propertyValue` pair, where **property name can be only a string**. If it's not a string, it gets casted into a string. You can specify properties **when creating** an object **or later**. There may be zero or more properties separated by commas.
Object's property is a `propertyName`: `propertyValue` pair, where the **property name can be only a string**. If it's not a string, it gets casted into a string. You can specify properties **when creating** an object **or later**. There may be zero or more properties separated by commas.
Copy link
Contributor

Choose a reason for hiding this comment

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

You can specify properties when creating an object or later.

This line can be better framed

// The lines above do the same thing. The difference is that the second one lets you use litteraly any string as a property name, but it's less readable.
// The lines above do the same thing. The difference is that the second one
// lets you use literally any string as a property name, but it's less
// readable.
Copy link
Contributor

Choose a reason for hiding this comment

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

can be in the previous line

```js
var stringRepresentation = adult.toString();
// the variable has value of '[object Object]'
```

`toString` is an Object.prototype's property, which was inherited. It has a value of a function, which returns a string representation of the object. If you want it to return a more meaningful representation, then you can override it. Simply add a new property to the adult object.
The property `toString` is an Object.prototype's property, which was inherited. It has a value of a function, which returns a string representation of the object. If you want it to return a more meaningful representation, then you can override it by simply adding a new property to the adult object.
Copy link
Contributor

Choose a reason for hiding this comment

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

The property toString

The toString property

Copy link
Contributor

@Purukitto Purukitto left a comment

Choose a reason for hiding this comment

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

I had added comments for things I think can be changed/removed/improved.

I hope you consider them.

You can ignore the suggestions about the comments line breaks, but I think it is better to have less line breaks in the particular case of this repo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants