-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
108 lines (68 loc) · 2.14 KB
/
app.js
File metadata and controls
108 lines (68 loc) · 2.14 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
// Q : 1
// var itemsArray = [
// {name:"juice", price:"50", quantity:"3"},
// { name:"cookie", price:"30", quantity:"9"},
// {name:"shirt", price:"880", quantity:"1"},
// {name:"pen", price:"100", quantity:"2"}];
// function totalPriceOfAllItems(){
// let totalPriceAllItems= 0;
// itemsArray.forEach(function(item){
// var totalItems = parseFloat(item.price)* parseFloat(item.quantity);
// console.log("the total price of" + item.name + " " + totalItems)
// totalPriceAllItems += totalItems;
// })
// console.log("Total price of all items: " + totalPriceAllItems);
// }
// totalPriceOfAllItems();
// DONE
// Q : 2
// const obj = {
// name: "hasan",
// email : "hasankhan@gmail.com",
// password : "hasan",
// age : 20,
// phone : 1234567890,
// city : "karachi",
// country: "pakistan"
// }
// if(obj.hasOwnProperty("age")) {
// console.log("age property exists in object");
// }else{
// console.log("age property does not exists in object");
// }
// if(obj.hasOwnProperty("country")) {
// console.log("country property exists in object");
// }else{
// console.log("country property does not exists in object");
// }
// if(obj.hasOwnProperty("firstName")) {
// console.log("firstName property exists in object");
// }else{
// console.log("firstName property does not exists in object");
// }
// if(obj.hasOwnProperty("lastName")) {
// console.log("lastName property exists in object");
// }else{
// console.log("lastName property does not exists in object");
// }
// DONE
// Q : 3
// function Record(name,age,city,email){
// this.name = name;
// this.age = age;
// this.city = city;
// this.email = email;
// }
// var record1 = new Record("hasan",20,"karachi","new york");
// var record2 = new Record("ahad",20,"lahores","new york");
// console.log(record1.name);
// console.log(record1.age);
// console.log(record1.city);
// console.log(record1.email);
// console.log(record2.name);
// console.log(record2.age);
// console.log(record2.city);
// console.log(record2.email);
// DONE
// Q : 4
// NOT DONE