Przeglądaj źródła

home work 2 second stage

Антон Фролов 4 lat temu
rodzic
commit
47641f4523
3 zmienionych plików z 25 dodań i 3 usunięć
  1. 1 1
      hw1/index.html
  2. 3 2
      hw1/index.js
  3. 21 0
      hw2/index.js

+ 1 - 1
hw1/index.html

@@ -11,4 +11,4 @@
   
   <script src="index.js"></script>
   </body>
-</html>
+</html>

+ 3 - 2
hw1/index.js

@@ -35,6 +35,8 @@ const weeksAmount = 8;
 
 let result = Math.ceil((weeksAmount * consumptionPerWeek) / sheetsInReamPaper);
 
+// переписать код выше через if и %
+
 console.log(result)
 
 console.log('---End Third Part---')
@@ -71,5 +73,4 @@ for(let i = 1; i <= medianNumber; i++) {
       linia += '-'
     } 
     console.log(linia + reshotka + linia)
-}
-
+}

+ 21 - 0
hw2/index.js

@@ -1,3 +1,5 @@
+// Stage 1
+
 const citiesAndCountries = {
 	'Киев': 'Украина',
 	'Нью-Йорк': 'США',
@@ -12,3 +14,22 @@ for (let key in citiesAndCountries) {
       console.log(key + ' это ' + citiesAndCountries[key]);
 }
 
+// _________________
+
+// Stage 2
+
+function getArray(){
+    const amount = 12;
+    const arrA = [];
+    let k = 0;
+    for (let i = 0; i < (amount / 3); i++) {
+      arrA[i] = [];      
+      for (let j = 0; j < 3; j++) {
+        k = k + 1;               
+        arrA[i][j] = k;
+      }
+    }
+    return arrA;
+}
+
+console.log (getArray());