Skip to content

Commit bcde47e

Browse files
Update Intro in Windowing System Exercise (#2481)
* Corrected typo on mileage (was spelt milage). * Added two grammatical corrections from original concept's introduction section.
1 parent 0f10c64 commit bcde47e

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

exercises/concept/windowing-system/.docs/introduction.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
JavaScript includes the capabilities for object-oriented programming ([OOP][wiki-oop]).
44
In OOP, you want to create objects (_instances_) from "templates" (_classes_) so that they include certain data and functionality.
5-
The data properties are called _fields_ in the OOP context, function properties are called _methods_.
5+
The data properties are called _fields_ in the OOP context, the function properties are called _methods_.
66

77
JavaScript did not have classes at all before they were added to the language specification in 2015 but allowed for object-oriented programming using prototype-based inheritance.
88
And even though a `class` keyword is available nowadays, JavaScript is still a _prototype-based_ language.
99

10-
To understand what it means to be a prototype-based language and how JavaScript works, we will go back to the time when there were no classes.
10+
To understand what it means to be a prototype-based language and how JavaScript actually works, we will go back to the time when there were no classes.
1111

1212
## Prototype Syntax
1313

@@ -184,24 +184,24 @@ With the keywords `get` and `set` you can define functions that are executed whe
184184
```javascript
185185
class Car {
186186
constructor() {
187-
this._milage = 0;
187+
this._mileage = 0;
188188
}
189189

190-
get milage() {
191-
return this._milage;
190+
get mileage() {
191+
return this._mileage;
192192
}
193193

194-
set milage(value) {
195-
throw new Error(`Milage cannot be manipulated, ${value} is ignored.`);
194+
set mileage(value) {
195+
throw new Error(`Mileage cannot be manipulated, ${value} is ignored.`);
196196
// Just an example, usually you would not provide a setter in this case.
197197
}
198198
}
199199

200200
const myCar = new Car();
201-
myCar.milage;
201+
myCar.mileage;
202202
// => 0
203-
myCar.milage = 100;
204-
// => Error: Milage cannot be manipulated, 100 is ignored.
203+
myCar.mileage = 100;
204+
// => Error: Mileage cannot be manipulated, 100 is ignored.
205205
```
206206

207207
---

0 commit comments

Comments
 (0)