let body = { tagName: 'body', children: [ { tagName: 'div', children: [ { tagName: 'span', innerText: 'Enter a data please:' }, { tagName: 'br' }, { tagName: 'input', type: 'text', id: 'name' }, { tagName: 'input', type: 'text', id: 'surname' } ] }, { tagName: 'div', children: [ { tagName: 'button', innerText: 'OK', id: 'ok' }, { tagName: 'button', innerText: 'Cancel', id: 'cancel' } ] } ] }; console.log(body.children[1].children[1].innerText) console.log(body.children[0].children[3].id) var person; var notebook = { brand: prompt('Brand:'), type: prompt('Type:'), model: prompt('Model:'), ram: +prompt('Ram:'), size: +prompt('Size:'), weight: +prompt('Weight:'), resolution: { width: +prompt('Resolution width:'), height: +prompt('Resolution height:'), }, owner: person }; var phone = { brand: prompt('Brand:'), model: prompt('Model:'), ram: +prompt('Ram:'), color: prompt('Color:'), owner: person }; person = { name: prompt('Name:'), surname: prompt('Surname:'), married: confirm('Married?'), smartphone: phone, laptop: notebook }; let array1 = [] array1[0] = prompt('string 1'); array1[1] = prompt('string 2'); array1[2] = prompt('string 3'); let confirm1; while(!confirm1) { confirm1 = confirm('Are you hungry?'); if(confirm1) { break; } } let prompt1; let array2 = [] while(prompt1 !== null) { prompt1 = prompt('Enter something'); array2.push(prompt1) if(!prompt1) { break } console.log(array2) } let prompt2 = prompt('Enter something'); let array3 = [] do { let i = 0; prompt2 ? array3[i++] = prompt2 : null console.log(array3) } while(prompt2 !== null) let i = 0; let n; while(n !== 5) { i++ let n = Math.random() * 5; console.log(n) console.log(i) if(n === 5) { break } } let end = +prompt('Введите крайнее число прогрессии') let sum = 0; for(let i = 1; i < 30; i+=3){ console.log(i) sum += i } alert(`Сумма чисел в прогрессии - ${sum}`); let chessString = ''; for(let i = 0; i < 10; i++) { i % 2 === 0 ? chessString += ' ' : chessString += '#' } console.log(chessString); let numbers2 = ''; for(let i = 0; i < 10; i++) { numbers2 += '\n' for(let j = 0; j < 10; j++) { numbers2 += j } } console.log(numbers2) let height = 8; let width = 10; let board = ""; for (let i = 0; i < height; i++) { if(i > 0) board += "\n"; for (let j = 0; j < width; j++) { if ((j + i) % 2 === 0){ board += "."; } else { board += "#"; } } } console.log(board); let numbers = []; for(let i = 0; i < 15; i++) { numbers.push(Math.pow(i, 3)); } console.log(numbers) let multiplyTable = []; for(let i = 0; i <= 9; i++) { let nestedArr = [] multiplyTable.push(nestedArr) for(let j = 0; j <= 9; j++) { nestedArr.push([j * i]) } } console.log(multiplyTable[5][6]) let table = document.createElement('table') for(let i = 1; i <= 9; i++) { let tr = document.createElement('tr'); for(let j = 1; j <= 9; j++) { let td = document.createElement('td') td.innerHTML = String(j * i) tr.appendChild(td) } table.appendChild(tr) } document.body.appendChild(table)