-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
73 lines (61 loc) · 1.45 KB
/
script.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//template literals
var a=10;
var b=20;
var c=parseInt(a+b);
{
console.log(`the "value" of
sum is:${c}`)
}
//-------------------------------------------------------------------------
//this method
// const car1={
// model:"i20",
// color:"blue",
// drive: function()//method not a function()
// {
// console.log(`you drive this ${this.color}`)
// }
// }
// const car2 ={
// model:"x90",
// color:"black",
// drive:function(){
// console.log(`you drive this ${this.color}`)
// }
// }//this is refer to globle
// car1.drive();
// car2.drive();
//----------------------------------------------------------------------------
//classes c
// class Car{
// drive(){
// console.log("driving")
// }
// break(){
// console.log("brake")
// }
// }
// let car1=new Car()
// car1.drive();
// car1.break();
// let car2=new Car()
// car2.drive();
//-----------------------------------------------------------
//constructor
// class Car{
// constructor(brand,model,color,year){
// this.brand=brand;
// this.model=model;
// this.color=color;
// this.year=year;
// }
// drive(){
// console.log("driving")
// }
// break(){
// console.log("brake")
// }
// }
// let car1=new Car("hyundai","i20","red","2023")
// console.log(car1);
// ----------------------------------------------------