List of Exercises # 4
1) An e-commerce website has two types of shipments:
- Standard: 7 days
- Express: 3 days
When changing the type of shipment, update the information below:
Order date:
Expected date of delivery:
Delivery Fee:
* The fee should be retrieved from the object below and shoud be shown with 2 decimal places.
var shipments =
{
'standard': {
'leadTime': 7,
'fee': 2
},
'express': {
'leadTime': 3,
'fee': 4.5
}
};
2) Update the product's name, price and image when changing the selected option.
iPhone SE 64GB Red
US$ 450.00
The price should be shown with 2 decimal places and should be preceded by the currency. Use the object below to retrieve the product information:
var phones =
{
'iphone_se_red': {
'name': 'iPhone SE 64GB Red',
'price': '450',
'currency': 'US$',
'imageUrl': "https://www.mhr.pt/232729-large_default/apple-iphone-se-64gb-red.jpg"
},
'iphone_11_black': {
'name': 'iPhone 11 128GB Black',
'price': '869',
'currency': 'EUR',
'imageUrl': "https://assets.swappie.com/iphon11musta1-300x300.jpg"
},
'iphone_8_plus_silver': {
'name': 'iPhone 8 Plus 64GB Silver',
'price': '519',
'currency': 'US$',
'imageUrl': "https://www.mhr.pt/196170/apple-iphone-8-plus-64gb-silver.jpg"
}
};
3) Make the stopwatch below work. The format is in hours, minutes, seconds and milliseconds.
00:00:00 000