1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Document</title>
- </head>
- <body>
- <ul id="box"></ul>
- <script>
- /*
- 题目:使用 HTML 和 JavaScript 使用 for of 方法计算出学生所有成绩的总和,并将结果显示在页面上。
- 要求:
- 使用js在 HTML 中创建<li> 元素,用于显示结果。
- 要求页面显示样式为:学生姓名:张三,总成绩:xxx分。
- 使用 JavaScript 的 for of、for in 方法进行操作。
- 可用 css/js 为列表项添加样式,如设置字体大小、颜色等。
- */
- const arr = [
- {
- name: '张三',
- score: {
- chinese: 85,
- math: 80,
- english: 77
- }
- },{
- name: '李四',
- score: {
- chinese: 66,
- math: 72,
- english: 55
- }
- },{
- name: '王五',
- score: {
- chinese: 87,
- math: 99,
- english: 100
- }
- },{
- name: '赵六',
- score: {
- chinese: 40,
- math: 62,
- english: 53
- }
- },{
- name: '田七',
- score: {
- chinese: 88,
- math: 92,
- english: 77
- }
- }
- ]
- </script>
- </body>
- </html>
|