-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwritingEMailUsingData (III).html
49 lines (47 loc) · 1.48 KB
/
writingEMailUsingData (III).html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Learning JS</title>
</head>
<body>
<h1>E-Mailing</h1>
<script>
let customerData = [
{
name: "James",
productPurchased: "phone",
productPrice: 200,
locale: "de-DE",
currency: "EUR",
},
{
name: "Carlos",
productPurchased: "car",
productPrice: 20000,
locale: "de-DE",
currency: "EUR",
},
{
name: "Sevtap",
productPurchased: "Xbox",
productPrice: 400,
locale: "en-GB",
currency: "GBP",
},
];
function display(data){
return "Dear " + data.name + ", thanks for your purchase of a " + data.productPurchased + " for the price of " + data.productPrice;
}
for(let i=0; i<customerData.length; i++){
if(customerData[i].currency == "EUR"){
console.log(display(customerData[i]) + "€");
} else if(customerData[i].currency == "GBP"){
console.log(display(customerData[i]) + "£");
}
}
</script>
</body>
</html>