-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExercise10.html
More file actions
55 lines (50 loc) · 2.09 KB
/
Exercise10.html
File metadata and controls
55 lines (50 loc) · 2.09 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Exercise 10</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<script type="text/javascript">
//Crear un programa que reciba un número del 1 al 7 y muestre el nombre de la película Star Wars correspondiente.
let number = parseInt(prompt('Ingrese un numero de una pelicula de Star Wars, y adivino su nombre'));
function starWarsMovieByNumber(number) {
let movie = null;
switch (number) {
case 1: case 'I':
movie = 'Star Wars I - La Amenaza fantasma'
break;
case 2: case 'II':
movie = 'Star Wars II - La ataque de los clones'
break
case 3: case 'III':
movie = 'Star Wars III - La venganza de los Sith'
break
case 4: case 'VI':
movie = 'Star Wars IV - Una nueva esperanza'
break
case 5: case 'V':
movie = 'Star Wars V - El imperio contraataca'
break
case 6: case 'VI':
movie = 'Star Wars VI - El retorno del Jedi'
break
case 7: case 'VII':
movie = 'Star Wars VII - El despertar de la fuerza'
break
case 8: case 'VIII':
movie = 'Star Wars VIII - Los últimos Jedi'
break
default:
movie = 'No existe esa pelicula de Star Wars, intenta con otro numero :('
break
}
return movie;
}
alert(starWarsMovieByNumber(number));
</script>
</body>
</html>