-
Notifications
You must be signed in to change notification settings - Fork 0
/
Objects.js
36 lines (32 loc) · 820 Bytes
/
Objects.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
// let myCar = {
// speed: 60,
// Model: "Audi",
// drive: function() {
// console.log("i'm driving");
// },
// getSpeed: function() {
// console.log("my speed is " + this.speed);
// }
// }
function myCar(speed, Model) {
this.speed = speed;
this.Model = Model;
this.drive = function() {
console.log("i'm driving");
};
this.getSpeed = function() {
console.log("my speed is " + this.speed);
};
}
let car = new myCar(40, "Honda");
car.drive();
car.getSpeed();
console.log(car);
//Date Object
let today = new Date();
console.log(today);
console.log("month " + today.getMonth());
console.log("day " + today.getDay());
console.log("date " + today.getDate());
console.log("year " + today.getFullYear());
console.log("time " + today.getTime());