Jelajahi Sumber

Some fixes added to hometask 4

pocu46 4 tahun lalu
induk
melakukan
6f9e4316d9
1 mengubah file dengan 26 tambahan dan 7 penghapusan
  1. 26 7
      04/script.js

+ 26 - 7
04/script.js

@@ -172,7 +172,7 @@
 
 // --------------------------------progression sum---------------------------------------------
 
-// let progressionLenght = +prompt("Enter progression lenght", "Should be a Number");
+// let progressionLenght = +prompt("Enter progression lenght", "Should be a Number");       // Нужно исправить
 // let progressionTotal = 1;
 
 // for(let i=1; i<progressionLenght; i++) {
@@ -181,6 +181,22 @@
 
 // console.log(`progressionTotal = ${progressionTotal}`);
 
+// let progressionLenght = +prompt("Enter progression lenght", "Should be a Number");   // Правильный код с формулой суммы
+// let progression = [1];       
+// let progressionTotal;
+// let temp = 1;
+
+// for(let i=1; i<progressionLenght; i++) {
+//     temp += 3;
+//     progression.push(temp);
+// }
+
+// console.log(progression);
+
+// progressionTotal = ((progression[0] + progression[progression.length - 1]) * progressionLenght) / 2;
+
+// console.log(`progressionTotal = ${progressionTotal}`);
+
 // --------------------------------chess one line---------------------------------------------
 
 // let strLenght = +prompt("Enter string lenght", "Should be a Number");
@@ -216,7 +232,7 @@
 // let arrLenght = +prompt("Enter Array lenght");
 
 // for(let i=0; i<arrLenght; i++) {
-//     arr.push(i * i);
+//     arr.push(i * i * i);
 // }
 
 // console.log(arr);
@@ -232,12 +248,15 @@
 
 // console.log(`Gipsy says ${forcast}`);
 
-// let userNumber = +prompt("Enter o or 1", "0 or 1");            //   Нужно починить
+// let userNumber = +prompt("Enter o or 1  dhvjbv", "0 or 1");            //   Нужно починить
 
-// // while(userNumber != 0 || userNumber != 1) {
-// //     alert("You need to enter 0 or 1");
-// //     userNumber = +prompt("Enter o or 1", "0 or 1");
-// // }
+// console.log(typeof userNumber);
+// debugger;
+// while(userNumber !== 0 || userNumber !== 1) {
+// // while(userNumber !== Number) {
+//     alert("You need to enter 0 or 1");
+//     userNumber = +prompt("Enter o or 1", "0 or 1");
+// }
 
 // let history = [1, 1, 1, 1];