- Implemented exercises for array high-order methods, memory and execution, switch statements, and final review. - Added starter and answer files for each exercise to facilitate learning. - Created a runner HTML file to execute JavaScript code and display console outputs. - Updated README files to include exercise objectives, tasks, and usage instructions.
29 lines
810 B
Markdown
29 lines
810 B
Markdown
# 练习 15:switch、break 和空值判断
|
||
|
||
## 目标
|
||
|
||
学会在分支判断里使用 `switch`,并区分 `undefined`、`null` 这两种常见空值。
|
||
|
||
## 你要练什么
|
||
|
||
- `switch`
|
||
- `break`
|
||
- `undefined`
|
||
- `null`
|
||
- 空值判断
|
||
|
||
## 任务
|
||
|
||
请完成一个“学习记录检查器”脚本,要求:
|
||
|
||
- 用 `switch` 根据学习状态输出不同说明
|
||
- 观察 `undefined` 和 `null` 的区别
|
||
- 用循环读取学习记录
|
||
- 如果读到 `undefined` 或 `null`,立即用 `break` 停止循环
|
||
- 输出停止前已经读取到的内容
|
||
|
||
## 文件
|
||
|
||
- [starter.js](/Users/lijiaqing/home/wwwroot/front-end-example/03-javascript-core/15-switch-break-and-empty-values/starter.js)
|
||
- [answer.js](/Users/lijiaqing/home/wwwroot/front-end-example/03-javascript-core/15-switch-break-and-empty-values/answer.js)
|