// html tree
let body = {
tagName: "body",
subTags: [
{tagName: 'div',
subTags:[
{tagName:'br'},
{tagName:'span', text: 'Enter a data please:'},
{tagName:'input', attrs:{type:'text', id:'name'}},
{tagName:'input', attrs:{type:'text', id:'surname'}}
]},
{tagName: 'div',
subTags:[
{tagName:'button', text:'OK', attrs:{id:'ok'}},
{tagName:'button', text:'Cancel', attrs:{id:'cancel'}}
]}
]
}
body.subTags[1].subTags[1].text
body.subTags[0].subTags[3].attrs.id
// declarative fields
let notebook = {
brand: prompt('Enter brand'),
type: prompt('Enter type'),
model: prompt('Enter model'),
ram: +prompt('Enter ram'),
size: prompt('Size'),
weight: +prompt('Weight'),
resolution: {
width: +prompt ('Width'),
height: +prompt ('Height'),
},
};
let phone = {
brand: prompt('Enter brand'),
model: prompt('Enter model'),
ram: +prompt('Enter ram'),
color: prompt('Enter color'),
};
let person = {
name: prompt('Enter a name'),
surname: prompt('Enter a surname'),
married: confirm(),
}
// object links
let person1 = {
name:prompt('Enter a name'),
smartphone:{ owner:person1},
laptop:{ owner:person1}
}
// imperative array fill 3
let array = [];
array[0] = +prompt();
array[1] = +prompt();
array[2] = +prompt();
// while confirm
let qvestion = '';
while(qvestion != true){
qvestion = confirm('are you batman?')}
// array fill
let array1 = [];
let filling = '';
while(filling != null){
filling = prompt('введите число'),
array1.push(filling);
}
// array fill nopush\
let array2 = [];
let i = 0;
let filling1 = '';
while(filling1 != null){
filling1 = prompt('введите число')
array2[i] = filling1;
i++
}
// infinite probability(?)
let a = Math.random()
let b = 0
while( a < 0.9){
b + 1;
break;
}
// empty loop
let value = '';
while(value != prompt());
// progression sum
let sum = 0;
for(i = 1; i < 50; i+=3){
sum = sum + i}
console.log(sum);
// chess one line
let c = '';
for(y = 0;y < 21;y++){
if(y % 2 === 1){
c = c + '#'}
else {
c = c + ' '}}
// numbers
let x = ""
for (let i = 0; i < 10; i++){
x = x + "\n"
for (let i = 0; i < 1; i++){
x = x + 0
for (let i = 0; i < 1; i++){
x = x + 1
for (let i = 0; i < 1; i++){
x = x + 2
for (let i = 0; i < 1; i++){
x = x + 3
for (let i = 0; i < 1; i++){
x = x + 4
for (let i = 0; i < 1; i++){
x = x + 5
for (let i = 0; i < 1; i++){
x = x + 6
for (let i = 0; i < 1; i++){
x = x + 7
for (let i = 0; i < 1; i++){
x = x + 8
for (let i = 0; i < 1; i++){
x = x + 9
}
}
}
}
}
}
}
}
}
}
}
console.log(x)
// chess(??????????)<
// cubes(?????????)
// multiply table(???????)
// matrix to html table(????????)
// не понял с этого задания>