Skip to content

Commit bc404ec

Browse files
fuzzknobdimadeveatii
authored andcommitted
Fixes (labs42io#22)
* Fixed usage of for-in loop in iterator example. * Fixed typos.
1 parent 563f4f6 commit bc404ec

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,7 +1032,7 @@ function* fibonacci(): IterableIterator<number> {
10321032

10331033
function print(n: number) {
10341034
let i = 0;
1035-
for (const fib in fibonacci()) {
1035+
for (const fib of fibonacci()) {
10361036
if (i++ === n) break;
10371037
console.log(fib);
10381038
}
@@ -1070,7 +1070,7 @@ itiriri(fibonacci())
10701070
### Use getters and setters
10711071

10721072
TypeScript supports getter/setter syntax.
1073-
Using getters and setters to access data from objects that encapsulate behavior could be better that simply looking for a property on an object.
1073+
Using getters and setters to access data from objects that encapsulate behavior could be better than simply looking for a property on an object.
10741074
"Why?" you might ask. Well, here's a list of reasons:
10751075

10761076
- When you want to do more beyond getting an object property, you don't have to look up and change every accessor in your codebase.
@@ -1686,7 +1686,7 @@ class HttpRequester {
16861686

16871687
This is a scary term for a very simple concept. It's formally defined as "If S is a subtype of T, then objects of type T may be replaced with objects of type S (i.e., objects of type S may substitute objects of type T) without altering any of the desirable properties of that program (correctness, task performed, etc.)." That's an even scarier definition.
16881688

1689-
The best explanation for this is if you have a parent class and a child class, then the base class and child class can be used interchangeably without getting incorrect results. This might still be confusing, so let's take a look at the classic Square-Rectangle example. Mathematically, a square is a rectangle, but if you model it using the "is-a" relationship via inheritance, you quickly get into trouble.
1689+
The best explanation for this is if you have a parent class and a child class, then the parent class and child class can be used interchangeably without getting incorrect results. This might still be confusing, so let's take a look at the classic Square-Rectangle example. Mathematically, a square is a rectangle, but if you model it using the "is-a" relationship via inheritance, you quickly get into trouble.
16901690

16911691
**Bad:**
16921692

0 commit comments

Comments
 (0)