Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d2cae36

Browse files
committed
Fixed xcatliu#5
1 parent cb2adf1 commit d2cae36

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

introduction/hello-typescript.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function sayHello(person: string) {
1010
}
1111

1212
let user = 'Xcat Liu';
13-
document.body.innerHTML = sayHello(user);
13+
console.log(sayHello(user));
1414
```
1515

1616
然后执行
@@ -26,7 +26,7 @@ function sayHello(person) {
2626
return 'Hello, ' + person;
2727
}
2828
var user = 'Xcat Liu';
29-
document.body.innerHTML = sayHello(user);
29+
console.log(sayHello(user));
3030
```
3131

3232
TypeScript 中,使用 `:` 指定变量的类型,`:` 的前后有没有空格都可以。
@@ -45,7 +45,7 @@ function sayHello(person: string) {
4545
}
4646

4747
let user = [0, 1, 2];
48-
document.body.innerHTML = sayHello(user);
48+
console.log(sayHello(user));
4949
```
5050

5151
编辑器中会提示错误,编译的时候也会出错:
@@ -61,7 +61,7 @@ function sayHello(person) {
6161
return 'Hello, ' + person;
6262
}
6363
var user = [0, 1, 2];
64-
document.body.innerHTML = sayHello(user);
64+
console.log(sayHello(user));
6565
```
6666

6767
**TypeScript 编译的时候即使报错了,还是会生成编译结果**,我们仍然可以使用这个编译之后的文件。

0 commit comments

Comments
 (0)