forked from Zelechos/Pragmatic_JavaScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExercise15.js
More file actions
80 lines (64 loc) · 2.18 KB
/
Copy pathExercise15.js
File metadata and controls
80 lines (64 loc) · 2.18 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// Crear un Programa que calcule la funciones trigonometricas basicas
const AppWebTrigonometric = ()=>{
let funTrigonometric, number;
do{
funTrigonometric = inputOption();
if(funTrigonometric != 7){
number = parseInt(prompt("Enter a number : "));
}
switch(funTrigonometric){
// esto no es necesario pero recuerda estamos aprendiendo
case 1:
((function (number){
console.log(Math.sin(number));
})(number));
break;
case 2:
((function (number){
console.log(Math.cos(number));
})(number));
break;
case 3:
((function (number){
console.log(Math.tan(number));
})(number));
break;
case 4:
((function (number){
console.log(1/Math.cos(number));
})(number));
break;
case 5:
((function (number){
console.log(1/Math.sin(number));
})(number));
break;
case 6:
((function (number){
console.log(1/Math.tan(number));
})(number));
break;
case 7:
!function(text){
if(confirm(text)){
alert("goodbye")
console.log("goodbye");
}else{
// reiniciamos la variable para que siga su proceso
funTrigonometric = 0;
}
}("Program End ?");
break;
default:
!function(message){
console.log(message);
}("The Option not Exist!!!");
break;
}
}while(funTrigonometric != 7);
}
const inputOption = ()=>{
let funTrigonometric = parseInt(prompt("Select a trigonometric function : \n 1. Sen() \n 2. Cos() \n 3. Tan() \n 4. Sec() \n 5. Csc() \n 6. Cot() \n 7. Leave"));
return funTrigonometric;
}
AppWebTrigonometric();