Skip to content

Commit 137056d

Browse files
fuzzknobbeginor
authored andcommitted
Fixes (labs42io#22)
* Fixed usage of for-in loop in iterator example. * Fixed typos.
1 parent bd6d0a8 commit 137056d

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
@@ -1253,7 +1253,7 @@ function* fibonacci(): IterableIterator<number> {
12531253

12541254
function print(n: number) {
12551255
let i = 0;
1256-
for (const fib in fibonacci()) {
1256+
for (const fib of fibonacci()) {
12571257
if (i++ === n) break;
12581258
console.log(fib);
12591259
}
@@ -1297,7 +1297,7 @@ itiriri(fibonacci())
12971297
### 使用 getter 和 setter
12981298

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

13031303
- 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.
@@ -1985,7 +1985,7 @@ class HttpRequester {
19851985

19861986
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.
19871987

1988-
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.
1988+
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.
19891989

19901990
这是针对一个非常简单的里面的一个恐怖意图, 它的正式定义是: “如果 S 是 T 的一个子类型, 那么类
19911991
型为 T 的对象可以被类型为 S 的对象替换(例如, 类型为 S 的对象可作为类型为 T 的替代品)儿不需

0 commit comments

Comments
 (0)