Browse Source

small fix

vladislavaSim 1 year ago
parent
commit
2c05162369
1 changed files with 31 additions and 11 deletions
  1. 31 11
      HW6/main.js

+ 31 - 11
HW6/main.js

@@ -17,10 +17,16 @@ function intRandom(min = 0, max = 10) {
     return Math.round(Math.random() * (max - min - 1) + min)
 }
 
+// function greetAll(...arguments) {
+//     for(let arg of arguments) {
+//         alert(`Hello, ${arg}!`)
+//     }
+// }
+
 function greetAll(...arguments) {
-    for(let arg of arguments) {
-        alert(`Hello, ${arg}!`)
-    }
+    arguments = arguments.map(item => ' ' + item)
+    alert(`Hello, ${arguments}!`)
+
 }
 function sum(...arguments) {
     let result = 0
@@ -52,13 +58,27 @@ switch (sample.toLowerCase()){
 }
 
 let sampleObj = {
-        a: a(),
-        cube: cube(),
-        avg2: avg2(),
-        sum3: sum3(),
-        intRandom: intRandom(),
-        greetAll: greetAll(),
-        sum: sum(),
+        a() {
+            a('Test prompt')
+        },
+        cube() {
+            cube(50)
+        },
+        avg2() {
+            avg2(55, 17)
+        },
+        sum3() {
+            sum3(5, 82, 47)
+        },
+        intRandom() {
+            intRandom(1, 50)
+        },
+        greetAll() {
+            greetAll('Sonya', 'Kerry', 'Eve')
+        },
+        sum() {
+            sum(45, 741, 32, 14)
+        },
     };
 
-console.log(sampleObj[prompt("Введите название задания")]);
+console.log(sampleObj[prompt("Введите название задания")]());