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:
28
03-javascript-core/14-memory-and-execution/starter.js
Normal file
28
03-javascript-core/14-memory-and-execution/starter.js
Normal file
@@ -0,0 +1,28 @@
|
||||
let scoreA = 80;
|
||||
let scoreB = scoreA;
|
||||
|
||||
const userA = {
|
||||
name: "小周",
|
||||
city: "上海",
|
||||
};
|
||||
|
||||
const userB = userA;
|
||||
|
||||
function printStepOne() {
|
||||
console.log("步骤一");
|
||||
}
|
||||
|
||||
function printStepTwo() {
|
||||
console.log("步骤二");
|
||||
}
|
||||
|
||||
function updateUser(user) {
|
||||
// 任务:
|
||||
// 1. 修改 user.city
|
||||
}
|
||||
|
||||
// 任务:
|
||||
// 2. 修改 scoreB,观察 scoreA 是否变化
|
||||
// 3. 修改 userB.city,观察 userA.city 是否变化
|
||||
// 4. 按顺序调用 printStepOne 和 printStepTwo
|
||||
// 5. 调用 updateUser(userA)
|
||||
Reference in New Issue
Block a user