Skip to content

Commit 20e95c1

Browse files
committed
corrected typos
1 parent 6a9a5bf commit 20e95c1

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

fundamentals/oop_classes.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
### Object literals and Imperative Programming
44

5-
In earlier JavaScript lectures we saw that we can define object literals and use functions to access and manipulate their properties. A typical example is shown below, where have defined an array of objects, in this case each representing the name of a month and its associated number of days.
5+
In earlier JavaScript lectures we saw that we can define object literals and use functions to access and manipulate their properties. A typical example is shown below, where we have defined an array of objects, in this case each representing the name of a month and its associated number of days.
66

7-
We're looping through the month and printing a message to the console for each month with 31 days.
7+
We're looping through the months and printing a message to the console for each month having 31 days.
88

99
This style of programming is called Imperative Programming: we instruct the computer how to perform the task(s) at hand.
1010

@@ -35,9 +35,11 @@ for (const month of months) {
3535

3636
In the Functional Programming style (also referred to as Declarative Programming), we prefer to declare what the computer should do.
3737

38-
In the next example we have used the `filter` method to extract a subset of months with 31 days, used the `map` method to create an informational string about each month and a `forEach` method to output those strings to the console.
38+
In the next example we have used the `filter` method to extract a subset of months having 31 days, used the `map` method to create an informational string for each month and a `forEach` method to output those strings to the console.
3939

40-
Put in other words, we state or declare that the computer should **filter** our array according to some defined criterion, then it should **map** the filtered object to string and print out each string to the console. In contrast to the imperative style we do not have to infer from looking at the code what we are actually doing. Instead, the names of out functions and methods already imply what it is we want to achieve.
40+
Or, put in other words, we state or **declare** that the computer should **filter** our array according to some predefined criterion, then **map** each filtered object to a string and print out each string to the console.
41+
42+
In contrast to the imperative style we do not have to infer from looking at the code what we are actually doing. Instead, the names of our functions and methods already imply what it is we want to achieve.
4143

4244
```js
4345
const months = [

0 commit comments

Comments
 (0)