Skip to content

Commit

Permalink
fix: content change in Javascript #318
Browse files Browse the repository at this point in the history
Javascript content changed in chapter 6, 7 and 8
  • Loading branch information
reshmarajank committed Nov 1, 2021
1 parent 85768b2 commit d472417
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
30 changes: 15 additions & 15 deletions courses/javascript/arithmetic-operators.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,20 @@ testCase: [
]
---

We know many operators from school. They are things like addition +, multiplication \*, subtraction -, and so on.
We know many operators from school. They are things like addition `+`, multiplication `*`, subtraction `-`, and so on.

In this chapter, we’ll start with simple operators, then concentrate on JavaScript-specific aspects, not covered by school arithmetic.

The following math operations are supported:

- Addition +,
- Subtraction -,
- Multiplication \*,
- Division /,
- Remainder %,
- Exponentiation \*\*.
- Addition `+`,
- Subtraction `-`,
- Multiplication `*`,
- Division `/`,
- Remainder `%`,
- Exponentiation `**`.

The first four are straightforward, while % and \*\* need a few words about them.
The first four are straightforward, while `%` and `**` need a few words about them.

---

Expand Down Expand Up @@ -98,7 +98,7 @@ console.log(a / b); //2

## Exponentiation \*\*

The exponentiation operator a \*\* b raises a to the power of b.
The exponentiation operator `a ** b` raises a to the power of b.

In school maths, we write that as a^b .

Expand All @@ -108,9 +108,9 @@ console.log(2 ** 2); // 2² = 4

## Remainder %

The remainder operator %, despite its appearance, is not related to percents.
The remainder operator `%`, despite its appearance, is not related to percents.

The result of a % b is the remainder of the integer division of a by b.
The result of `a % b` is the remainder of the integer division of a by b.

```javascript
console.log(5 % 2); // 1, a remainder of 5 divided by 2
Expand All @@ -120,10 +120,10 @@ console.log(5 % 2); // 1, a remainder of 5 divided by 2

## Complete the tasks below:

- Create two variables a and b and assign values 5 and 2 respectively.
- Create two variables `a` and `b` and assign values 5 and 2 respectively.

- Perform an addition(+) operation on a and b and assign the value to a variable result.
- Perform an addition operation on `a` and `b` and assign the value to a variable `result`.

- Perform a multiplication(\*) operation on a and b and assign the value to a variable result.
- Perform a multiplication operation on `a` and `b` and assign the value to a variable `result`.

- Perform an modulus(%) operation on a and b and assign the value to a variable result.
- Perform a modulus operation on `a` and `b` and assign the value to a variable `result`.
12 changes: 6 additions & 6 deletions courses/javascript/if-condition.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@ testCase: [
]
---

The if(...) statement evaluates a condition in parentheses and, if the result is true, executes a block of code.
The `if(...)` statement evaluates a condition in parentheses and, if the result is `true`, executes a block of code.

```javascript
if (year == 2021) {
console.log("That's correct!");
}
```

## The else clause
## The `else` clause

The if statement may contain an optional else block. It executes when the condition is falsy.
The `if` statement may contain an optional `else` block. It executes when the condition is falsy.

```javascript
if (year == 2021) {
Expand All @@ -56,10 +56,10 @@ if (year == 2021) {

## Complete the tasks below:

- Create a variable "a" of type let with value 5
- Create a variable `a` of type let with value 5

- Check whether a equals 5
- Check whether `a` equals 5

- If a equals 5, print true in console
- If `a` equals 5, print `true` in console

- Use closing curly braces
6 changes: 3 additions & 3 deletions courses/javascript/switch-statement.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ switch(x) {
}
```

- The value of x is checked for a strict equality to the value from the first case (that is, value1) then to the second (value2) and so on.
- If the equality is found, switch starts to execute the code starting from the corresponding case, until the nearest break (or until the end of switch).
- If no case is matched then the default code is executed (if it exists).
- The value of `x` is checked for a strict equality to the value from the first case (that is, "value1") then to the second ("value2") and so on.
- If the equality is found, `switch` starts to execute the code starting from the corresponding case, until the nearest `break` (or until the end of `switch`).
- If no `case` is matched then the `default` code is executed (if it exists).

### Example

Expand Down

0 comments on commit d472417

Please sign in to comment.