瀏覽代碼

HW<6> fixed done

Illia Kozyr 2 年之前
父節點
當前提交
722eb9e630
共有 1 個文件被更改,包括 24 次插入11 次删除
  1. 24 11
      HW 6/index.html

+ 24 - 11
HW 6/index.html

@@ -9,7 +9,7 @@
     <body>
         <script>
             // -----------------------Анализ
-
+            
             function a(text) {
                 alert(text);
             }
@@ -44,7 +44,7 @@
 
             // -----------------------greetAll
 
-            function greetAll(a, b) {
+            function greetAll() {
                 let arr = "";
                 if (arr != "") {
                     arr = "";
@@ -56,7 +56,6 @@
                 arr = arr.slice(0, -2);
                 console.log(arr);
                 alert("Hello " + arr + "!");
-                return;
             }
 
             // ------------------------sum
@@ -121,16 +120,30 @@
             // ------------------------Union declarative
 
             let union = {
-                a: aSample(),
-                cube: cubeSample(),
-                avg2: avg2Sample(),
-                sum3: sum3Sample(),
-                intRandom: intRandomSample(),
-                greetAll: greetAllSample(),
-                sum: sumSample(),
+                a () {
+                    a("Hello") 
+                },
+                cube () {
+                    cube(10)
+                },
+                avg2 () {
+                    avg2(20, 30)
+                },
+                sum3 () {
+                    sum3(1, 2)
+                },
+                intRandom () {
+                    intRandom(1, 10)
+                },
+                greetAll () {
+                    greetAll("Anton", "Illia", "Andrey")
+                },
+                sum () {
+                    sum(1, 2, 3, 4, 5, 6, 7, 8, 9)
+                },
             };
 
-            console.log(union[prompt("Введите название задания")]);
+            console.log(union[prompt("Введите название задания")]());
         </script>
     </body>
 </html>