-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclasses.html
More file actions
44 lines (36 loc) · 1.1 KB
/
classes.html
File metadata and controls
44 lines (36 loc) · 1.1 KB
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
<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.29/browser.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.29/browser-polyfill.js"></script>
<script type="text/babel">
/* ES5 */
// function Vehicule(brand, color) {
// this.brand = brand;
// this.color = color;
//
// }
//
// var myOtherVehicule = new Vehicule("nissan2", "rouge2");
// Vehicule.prototype.hoonk = function () {
// console.log('tuuuuuuuuuut');
// };
/* ES6 */
class Vehicules {
constructor(brand, color) {
this.brand = brand;
this.color = color;
}
hoonk() {
console.log('tuuuuuut');
}
}
let myVehicule = new Vehicules("nissan", 'rouge');
console.log(myVehicule);
myVehicule.hoonk();
</script>
<title>ES6 via babel</title>
</head>
<body>
</body>
</html>