HTMLにJavascriptで表を完成させたいのですが、表示の仕方がわかりません。
この後のコードとして必要なコードはなんでしょうか。
お願いいたします。
<!DOCTYPE html> <html> <head> <title>明日の話題</title> </head> <body> <table> <tr> <th>生徒</th> <th>国語</th> <th>数学</th> <th>理科</th> <th>社会</th> <th>英語</th> <th>合計値</th> <th>ランク</th> </tr> </table> <style> </style> <script> class Score { //クラスの指定 constructor(total, name, NL, math, science, society, english) { this._name = name; this._NL = NL; this._math = math; this._science = science; this._society = society; this._english = english; } //メソットの指定 get name() { return this._name; } get NL() { return this._NL; } get math() { return this._math; } get science() { return this._science; } get society() { return this._society; } get english() { return this._english; } get total() { return this._NL + this._math + this._science + this._society + this._english; } } const a = new Score(this.total, 'Aさん', 80, 70, 70, 50, 60); const b = new Score(this.total, 'Bさん', 60, 70, 40, 80, 60); const c = new Score(this.total, 'Cさん', 60, 70, 70, 60, 60); const d = new Score(this.total, 'Dさん', 80, 40, 40, 70, 70); const e = new Score(this.total, 'Eさん', 70, 70, 70, 60, 70); const arr = [ a.total, b.total, c.total, d.total, e.total, ]; console.log(arr); </script> </body> </html>
まだ回答がついていません
会員登録して回答してみよう