-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathObjects.js
More file actions
51 lines (40 loc) · 1.15 KB
/
Objects.js
File metadata and controls
51 lines (40 loc) · 1.15 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
// // Object
// const product = {
// itemName: "phone",
// price: 35000,
// discount: 5000,
// itemCode: "F40"
// }
// // factory fucntion
// function createProduct(name, price, discount, itemCode){
// return {
// itemCode: name,
// price: price,
// discount: discount,
// itemCode: itemCode
// }
// }
// const footBall = createProduct("footBall", 4000, 1000, "f20")
// console.log(footBall);
// // constructer function
// function Product(name, price, discount, itemCode){
// this.itemCode = name;
// this.price = price;
// this.discount = discount;
// this.itemCode = itemCode;
// this.discountValue = function(){
// return price * discount/100;
// }
// }
// const samsungPhone = Product("samsungA30", 3400, 900, "y7")
// console.log(samsungPhone);
const users = [
{ name: "Alice", age: 30, email: "alice@example.com" },
{ name: "Bob", age: 25, email: "bob@example.com" },
{ name: "Charlie", age: 35, email: "charlie@example.com" },
];
function extractEmails(users) {
// Your code here
}
const emails = extractEmails(users);
console.log(emails);