-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
61 lines (48 loc) · 1.26 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>JS varialbe</title>
<script>
const moyenne = (notes) => {
let sum = 0
for (let note of notes){
sum = sum + note
}
return sum / notes.lenght
}
class Student {
ecole = 'Jules Ferry'
_notes = []
constructor(firstname, lastname) {
this.firstname = firstname
this.lastname = lastname
}
set notes (v) {
if(Array.isArray(v)){
this.notes = v
}
}
get name () {
return `${this.firstname} ${this.lastname}`
}
canPass () {
return moyenne(this.notes) >= 10
}
static moyenne = 10
}
const john = new Student('John', 'Doe')
const chloe = new Student('Chloé', 'Papin')
john.notes([10, 12, 9])
chloe.notes([15, 13, 20])
console.log(john.canPass(), chloe.canPass())
</script>
</head> 🍋
<body>
<h1>Exo JavaScript</h1>
<h2> Les classes </h2>
<p>Check la console !</p>
</body>
</html>