-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
12 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,13 @@ | ||
# 类型转换 | ||
|
||
### 强制类型转换 | ||
|
||
强制类型转换是将值从一种数据类型自动或隐式地转换为另一种数据类型(例如字符串转换为数字)。类型转换类似于强制类型转换,因为它们都将值从一种数据类型转换为另一种数据类型,只有一个关键的区别——强制类型转换是隐式的,而类型转换可以是隐式的,也可以是显式的。 | ||
|
||
```javascript | ||
const value1 = "5"; | ||
const value2 = 9; | ||
let sum = value1 + value2; | ||
|
||
console.log(sum); // '59' | ||
``` |