-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswitchcase.html
47 lines (40 loc) · 1.1 KB
/
switchcase.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
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Switch Case</title>
</head>
<body>
<p></p>
<script>
let bairro = prompt('Qual o bairro?')
let taxaEntrega
switch(bairro) {
case "Centro":
taxaEntrega = 30.00;
break;
case "Jd. Damasceno":
taxaEntrega = 50.00;
break;
case "Taipas":
taxaEntrega = 70.00;
default:
taxaEntrega = 20.00;
}
alert("A taxa de entrega é de R$: " +taxaEntrega.toFixed(2));
/////////////////////////////////////////////////////////////////////////////
fruta = prompt('Qual a fruta?')
switch(fruta) {
case "Banana":
alert('Olá')
break;
case "Maçã":
alert('Bem-vindo')
break;
default:
alert('Não existe este item')
}
</script>
</body>
</html>