|
@@ -86,6 +86,8 @@ person["laptop"] = laptop;
|
|
|
smartphone["owner"] = person;
|
|
|
laptop["owner"] = person;
|
|
|
|
|
|
+alert(person.smartphone.owner.laptop.owner.smartphone == person.smartphone); //true
|
|
|
+
|
|
|
//imperative array fill 3
|
|
|
let emptyArray = [];
|
|
|
|
|
@@ -148,6 +150,8 @@ do {
|
|
|
someQuestion = prompt('???');
|
|
|
} while (someQuestion != "")
|
|
|
|
|
|
+//while(prompt()===null) ;
|
|
|
+
|
|
|
//progression sum
|
|
|
let amountIteration = +prompt("Введите N: ");
|
|
|
let sum = 0;
|
|
@@ -193,7 +197,6 @@ let chessWidth = prompt("Размер доски (ширина)");
|
|
|
let chessHeight = prompt("Размер доски (высота)");
|
|
|
let chess = "";
|
|
|
let chessElement;
|
|
|
-let chess1 = ""
|
|
|
|
|
|
for (let i = 0; i < chessHeight; i++) {
|
|
|
|
|
@@ -219,3 +222,64 @@ for (let i = 0; i < chessHeight; i++) {
|
|
|
alert(chess);
|
|
|
|
|
|
//cubes
|
|
|
+let amountIndex = +prompt("Введите N: ");
|
|
|
+let arrayOfIndex = [];
|
|
|
+
|
|
|
+for (let i = 0; i < amountIndex; i++) {
|
|
|
+ arrayOfIndex[i] = Math.pow(i, 3);
|
|
|
+}
|
|
|
+
|
|
|
+alert("Ваш массив: " + arrayOfIndex);
|
|
|
+
|
|
|
+//multiply table
|
|
|
+let multiplyArray = [];
|
|
|
+
|
|
|
+for (let i = 0; i <= 10; i++) {
|
|
|
+ multiplyArray[i] = [];
|
|
|
+
|
|
|
+ for (let j = 0; j <= 10; j++) {
|
|
|
+ multiplyArray[i][j] = i * j;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+let firstNumber = +prompt("Введите первое число (1-10)");
|
|
|
+let secondNumber = +prompt("Введите второе число (1-10)");
|
|
|
+
|
|
|
+alert("Результат умножения: " + multiplyArray[firstNumber][secondNumber]);
|
|
|
+
|
|
|
+//matrix to html table
|
|
|
+let strToHtml = "<table border='1'>"
|
|
|
+
|
|
|
+for (let i = 1; i <= 10; i++) {
|
|
|
+ strToHtml += `<tr>`
|
|
|
+ for (let j = 1; j <= 10; j++) {
|
|
|
+ strToHtml += `<td style='padding: 5px'>${multiplyArray[i][j]}</td>`
|
|
|
+ }
|
|
|
+ strToHtml += `</tr>`
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+strToHtml += "</table>"
|
|
|
+document.write(strToHtml)
|
|
|
+
|
|
|
+//Задание на синий пояс: Треугольник
|
|
|
+let strTriangle = "";
|
|
|
+
|
|
|
+for (let i = 0; i < 6; i++) {
|
|
|
+
|
|
|
+ for (let j = 0; j < 5 - i; j++) {
|
|
|
+ strTriangle += ".";
|
|
|
+ }
|
|
|
+ for (let k = 0; k < i * 2 + 1; k++) {
|
|
|
+ strTriangle += "#";
|
|
|
+ }
|
|
|
+ for (let j = 0; j < 5 - i; j++) {
|
|
|
+ strTriangle += ".";
|
|
|
+ }
|
|
|
+
|
|
|
+ strTriangle += "\n"
|
|
|
+}
|
|
|
+
|
|
|
+alert(strTriangle);
|