-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
38 lines (25 loc) · 856 Bytes
/
main.js
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
console.log('hi!!!')
//// JavaScript Objects - Object Methods ----------------------------------------------------
// const person = {
// firstName: "John",
// lastName : "Doe",
// id : 5566,
// fullName : function() {
// return this.firstName + " " + this.lastName;
// }
// };
// //console.log(person);
// hisName = person.fullName();
// console.log(hisName);
//// JavaScript Classes --------------------------------------------------------------------
class Car {
constructor(carName, year){
this.carName = carName;
this.year = year;
}
}
// The example above creates a class named "Car". The class has two initial properties: "carName" and "year"
// creaing objects
const myCar1 = new Car('Ford', 2012);
const myCar2 = new Car('Beetle', 2009);
console.log(myCar1.carName);