forked from AnshRehan04/Javasript-With-Me
-
Notifications
You must be signed in to change notification settings - Fork 0
/
4.js
48 lines (40 loc) · 1000 Bytes
/
4.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
let name=['ansh','vedant','anmol'];
console.log(name[0]); //'ansh'
console.log(name[1]); //'vedant'
console.log(name[2]); //'anmol'
console.log(name[3]); //undefined
console.log(5>3);
console.log(5==3);
console.log(3==3);
console.log(5<3);
let num='2';
let num1='2';
console.log(num===num1);
// Object is created
let person={
first_name:'ansh',
age:19
}
console.log(person.first_name); //-->ansh
// let rectangle={
// length:12,
// breadth:13 , //Rectangle is object length and breadth are its property.
// //function
// draw:function(){
// console.log('draw');
// }
// };
console.log(rectangle.breadth) //-->13
// Factory Function
// Main function and in it object is created
function creatRectangle(){
let rectangle={
length:12,
breadth:13 , //Rectangle is object length and breadth are its property.
//function
draw:function(){
console.log('draw');
}
};
return rectangle;
}