题解 | #列表动态渲染# appendChild
列表动态渲染
https://www.nowcoder.com/practice/347e2e88f11a4b0c89157568f26ea126
<script> var people = [ { name: '牛油1号', id: 1, age: 20 }, { name: '牛油2号', id: 2, age: 21 }, { name: '牛油3号', id: 3, age: 19 }, ] var ul = document.querySelector('ul'); // 补全代码 for (var i=0;i<3;i++){ var li =document.createElement('li'); ul.appendChild(li); li.innerHTML=people[i].name+ ' ' + people[i].age+'岁'; } </script>