feat: Add JavaScript core exercises and solutions
- 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.
This commit is contained in:
14
03-javascript-core/13-array-high-order-methods/starter.js
Normal file
14
03-javascript-core/13-array-high-order-methods/starter.js
Normal file
@@ -0,0 +1,14 @@
|
||||
const scores = [58, 76, 91, 84];
|
||||
const students = [
|
||||
{ name: "小周", finished: true },
|
||||
{ name: "小林", finished: true },
|
||||
{ name: "小陈", finished: false },
|
||||
];
|
||||
|
||||
// 任务:
|
||||
// 1. 用 map 生成 ["58分", ...]
|
||||
// 2. 用 filter 筛出及格分
|
||||
// 3. 用 reduce 计算总分
|
||||
// 4. 用 find 找到第一个 >= 90 的分数
|
||||
// 5. 用 some 判断是否存在不及格
|
||||
// 6. 用 every 判断 students 是否都 finished 为 true
|
||||
Reference in New Issue
Block a user