//html tree
/*let body = {
tagName:'body',
paired: true,
attrs:{},
subTags: [
{
tagName:'div',
paired:true,
subTags: [
{
tagName:'span',
paired:true,
text:'Enter a data please',
},
{
tagName:'br',
paired:true,
attrs:{},
},
{
tagName:'input',
paired:true,
attrs:{
type:'text',
id:'name',
},
},
{
tagName:'input',
paired:true,
attrs:{
type:'text',
id:'surname', //body.subTags[0].subTags[3].attrs.id
},
}
]
},
{
tagName:'div',
paired:true,
subTags:[
{
tagName:'button',
paired:true,
attrs:{
id:'ok',
text:'ok',
},
tagName:'button', //body.subTags[1].subTags[0].attrs.text
paired:true,
attrs:{
id:'cancel',
text:'Cancel',
},
}
]
}
]
}*/
//declarative fields
/*let notebook = {
brand: prompt('Введите название'),
type: prompt('Введите id'),
model: prompt('Введите модель'),
ram: prompt('Введите кол-во ram'),
size: confirm('Вас устроит size-14?') || prompt('Введите данные size'),
weight: confirm('Вас устриоть weight 16?') || prompt('Введите данные weight'),
resolution: {
width: 1920,
height: 1080,
},
};
console.log(notebook)
let phone = {
brand: "meizu",
model: "m2",
ram: 2,
color: "black",
};
let person = {
name: "Donald",
surname: "Trump",
married: true,
}*/
//object links
/*var notebook = {
brand: "HP",
type: "440 G4",
model: "Y7Z75EA",
ram: 4,
size: "14",
weight: 1.8,
resolution: {
width: 1920,
height: 1080,
},
};
var phone = {
brand: "meizu",
model: "m2",
ram: 2,
color: "black",
};
var person = {
name: "Donald",
surname: "Trump",
married: true,
}
person.smartphone=phone;
person.laptop=notebook;
phone.owner=person;
notebook.owner=person;
console.log(person.smartphone.owner.laptop.owner.smartphone == person.smartphone)*/
//imperative array fill 3
/*var arr = [];
arr[0] = prompt('Введите элемент')
arr[1] = prompt('Введите элемент')
arr[2] = prompt('Введите элемент')
*/
//while confirm
/*let con = true;
do{
con = confirm()
}while(!con)*/
//array fill
/*arr = [];
a = prompt('Введит элемент')
while(a){
arr.push(a)
a = prompt('Введите элемент')
}*/
//array fill nopush
/*arr = []
a = prompt('Введит элемент')
let b = 0;
while(a){
arr[b++] = a;
a = prompt('Введите элемент')
} */
//infinite probability
/*let cons = 0;
while(true){
if(Math.random() > 0.9){
alert(cons)
break;
}
else{
cons++
}
}*/
//empty loop
/*while(prompt() == null){
}*/
// progression sum
/*let Num;
for(let i = 1;i < 30 ;i = i +3){
alert(i)
}*/
//chess one line
/*let size = prompt('Введите число')
var Symbol = "";
for (let a = 0; a < size; a++){
if((a + size)% 2 == 0)
Symbol +="#"
else
Symbol +="#";
}
console.log(Symbol)*/
//numbers
/*let Num = "\n";
for (let i = 0; i < 10; i++) {
for (let j = 0; j < 10; j++) {
Num +=j;
}
Num +="\n";
}*/
// chess
/*let size = 10;
var Symbol = "";
for (let a = 0; a < size; a++){
for(let b = 0; b <6; b++){
if((a + b)% 2 == 0)
Symbol +=".#."
else
Symbol +="#";
}
Symbol +="\n";
}
console.log(Symbol)*/
//cubes
/*var numbers = [1, 2, 3, 4, 5];
var cubes = new Array;
for (i in numbers) {
cubes[i] = Math.pow(numbers[i], 3);
alert(cubes)
}*/
//multiply table
/*let arr = [];
for(let i = 0; i <= 10; i++ ){
arr[i] = [];
for (let j = 0; j <= 10; j++ ){
arr[i][j] = i * j;
}
}
let sum = '';
for (let i = 1; i < 10; i++) {
sum += arr[i].slice(1).join(' ') + '\n';
}
console.log(arr);*/
//matrix to html table
/*var table, row, cell, i, j;
var table, row, cell, i, j;
table = document.createElement('table');
table.style.textAlign = 'right';
table.style.fontFamily = 'monospace';
for (i=1; i<10; i++) {
row = document.createElement('tr');
for (j=1; j<10; j++) {
cell = document.createElement(i == 1 || j == 1 ? 'th' : 'td');
cell.appendChild(document.createTextNode(i*j));
cell.style.padding = '4px';
cell.style.width = 100 / 9 + '%';
row.appendChild(cell);
}
table.appendChild(row);
}
document.body.appendChild(table);*/