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:
18
03-javascript-core/12-this-keyword/starter.js
Normal file
18
03-javascript-core/12-this-keyword/starter.js
Normal file
@@ -0,0 +1,18 @@
|
||||
const student = {
|
||||
name: "林晨",
|
||||
stage: "JavaScript 核心",
|
||||
sayHello() {
|
||||
// 任务:
|
||||
// 1. 用 this.name 输出问候语
|
||||
},
|
||||
createArrowReporter() {
|
||||
// 任务:
|
||||
// 2. 返回一个箭头函数
|
||||
// 3. 在箭头函数里输出 this.name
|
||||
},
|
||||
};
|
||||
|
||||
// 任务:
|
||||
// 4. 调用 student.sayHello()
|
||||
// 5. 把 student.sayHello 赋值给 detachedHello 再调用
|
||||
// 6. 调用 createArrowReporter 返回的新函数
|
||||
Reference in New Issue
Block a user