Marko hace 2 años
padre
commit
3c27263dce
Se han modificado 1 ficheros con 40 adiciones y 37 borrados
  1. 40 37
      file.js

+ 40 - 37
file.js

@@ -39,7 +39,7 @@ function intRandom(a,b) {
     }
 intRandom()
 
-// greetAll ???
+// greetAll ?
 let guys = "";
 function greetAll(){
     for(i = 0;i<arguments.length;i++){
@@ -61,64 +61,67 @@ function sum(){
 
 //    Union
 
-// function aSample(){
-//     a()
-// };
+function aSample(){
+   return a()
+};
 
-// function cubeSample(){
-//     cube()
-// };
+function cubeSample(){
+    return cube(2)
+};
 
-// function avg2Sample(){
-//     avg2()
-// };
+function avg2Sample(){
+   return avg2(3,4)
+};
 
-// function sum3Sample(){
-//     sum3()
-// };
+function sum3Sample(){
+   return sum3(5,6,7)
+};
 
-// function randomSample(){
-//     intRandom()
-// };
+function randomSample(){
+   return intRandom(8,12)
+};
 
-// function greetSample(){
-//     greetAll()
-// };
+function greetSample(){
+   return greetAll("Oleg","Jopa")
+};
 
-// function sumSample(){
-//     sum()
-// };
+function sumSample(){
+  return  sum(9,10,11,12,13)
+};
 
 let sample = prompt('Введите задание');
 switch(sample.toLowerCase()){
-    case "a": a()
+    case "a": aSample()
          break
-    case "cube": cube(2)
+    case "cube": cubeSample()
          break
-    case "avg2": avg2(3,4)
+    case "avg2": avg2Sample()
          break
-    case "sum3": sum3(5,6,7)
+    case "sum3": sum3Sample()
          break
-    case "intRandom": intRandom(8,12)
+    case "intRandom": randomSample()
          break
-    case "greetAll": greetAll("Oleg","Ivan")
+    case "greetAll": greetSample()
          break
-    case "sum": sum(9,10,11,13,14)
+    case "sum": sumSample()
          break
 }
 
 
-// Union declarative
+
+// Union declarative ?
 
 
 let samplee = {
-    "a": a(),
-    "cube": cube(2),
-    "avg2": avg2(3,4),
-    "sum3": sum3(5,6,7),
-    "intRandom": intRandom(8,12),
-    "greetAll": greetAll('Oleg','Ivan'),
-    "sum": sum(9,10,11,12,13)
+    "a": aSample(),
+    "cube": cubeSample(),
+    "avg2": avg2Sample(),
+    "sum3": sum3Sample(),
+    "intRandom": randomSample(),
+    "greetAll": greetSample(),
+    "sum": sumSample()
 }
+let qvestion = prompt('Какая функция?')
+alert(samplee[qvestion])