现在是最后一个任务——现有代码中存在 2 处错误,请找出并修正,使输出窗口得到正确结果,即:“我是某某,20 年后我?岁。”
尝试更新下方互动编辑器中的代码来实现预期效果:
<head>
<meta charset="utf-8" />
<title>变量:任务3</title>
<link
rel="stylesheet"
href="https://roy-tian.github.io/learning-area/javascript/introduction-to-js-1/tasks/styles.css" />
</head>
<body>
<section class="preview"></section>
<textarea class="playable playable-js" style="height: 300px;">
// 修改下面的代码
const myName = 'Default';
myName = '李雷';
let myAge = '18';
// 不要编写此行以下的代码!
section.innerHTML = ' ';
let para1 = document.createElement('p');
let para2 = document.createElement('p');
para1.textContent = `我是 ${myName}`;
para2.textContent = `20 年后我 ${myAge + 20} 岁`;
section.appendChild(para1);
section.appendChild(para2);
</textarea
>
<div class="playable-buttons">
<input id="reset" type="button" value="Reset" />
</div>
</body>
<script class="editable"></script>
<script src="https://roy-tian.github.io/learning-area/javascript/introduction-to-js-1/tasks/playable.js"></script>