-
Notifications
You must be signed in to change notification settings - Fork 0
/
classes.html
42 lines (29 loc) · 1019 Bytes
/
classes.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
<!DOCTYPE html>
<html>
<head>
<!-- Load babel 5 - babel-core -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.38/browser.js"></script>
<script>
class Vehicle {
// Constructor function
constructor(description, wheels) {
// properties for the Vehicle
this.description = description;
this.wheels = wheels;
}
// DescribeYouself method inside of class Vehicle
describeYourself () {
console.log(`I am ${this.description} with ${this.wheels} wheels.`);
}
}
// Create a new instance of Vehicle class
var suv = new Vehicle("Audi Q5", 4);
suv.describeYourself();
</script>
<title>Classes</title>
</head>
<body>
<h1>Hit the pit</h1>
<h2>Classes</h2>
</body>
</html>