123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- let body = {
- tagName: `body`,
- subTags : [
- {
- tagName: `div`,
- subTags: [
- {
- tagName:`span`,
- text:'Enter a data please:'
- },
- {
- tagName: `br`
- },
- {
- tagName: `input`,
- attrs:{type:'text', id:'name'}
- },
- {
- tagName: `input`,
- attrs:{type:'text', id:'surname'}
- },
- ]
- },
- {
- tagName: `div`,
- subTags: [
- {
- tagName:`bottom`,
- attrs:{id:'ok'}, text:`OK`
- },
- {
- tagName:`bottom`,
- attrs:{id:'cancel'}, text:`Cancel`
- }
- ]
- }
- ]
- }
- body.subTags[1].subTags[1].text
- body.subTags[0].subTags[3].attrs.id
-
- //declarative fields
-
- let notebook = {
- brand: prompt (`Enter a brand`),
- type: prompt('Enter a type'),
- model: prompt('Enter a model'),
- ram: +prompt('Enter a ram'),
- size: prompt('Size'),
- weight: +prompt('Weight'),
- resolution: {
- width: +prompt ('Width'),
- height: +prompt ('Height'),
- },
- };
- let phone = {
- brand: prompt('Enter a brand'),
- model: prompt('Enter a model'),
- ram: +prompt('Enter a ram'),
- color: prompt('Enter a color'),
- };
- let person = {
- name: prompt('Enter a name'),
- surname: prompt('Enter a surname'),
- married: confirm(),
- };
- //imperative array fill
- let element1 = +prompt(`Введите первый елемент`);
- let element2 = +prompt(`Введите второй елемент`);
- let element3 = +prompt(`Введите третий елемент`);
- let element = [];
- element.push (element1,element2,element3);
- alert(element);
- //while confirm
- let cake01 = ``;
- while(cake01!=true) {
- cake01 = confirm(`Будешь кекс`)
- }
- //array fill
- let arr0 = [];
- let add = ``;
- while(add != null)
- {
- add = prompt(`введите даные`),
- arr0.push(add);
- }
- //array fill nopush
- let arr01 = [];
- let j = 0;
- let add1 = ``;
- while(add1 != null)
- {
- add1 = prompt(`введите данные`),
- arr01[j] = add1; ++j
- }
- //empty loop
- let block = ``;
- while(block!= prompt());
- //progression sum
- let z = 0;
- for(i = 1; i < 50; i+=3){
- z = z + i}
-
- //chess one lin
- let h = '';
- for(i = 0; i < 15; i++){
- if(i % 2 === 1){
- h = h + ' '}
- else {
- h = h + '#'}}
- //numbers
- let str = ''
- for(i=0;i<10;i++){
- str += '\n'
- for(p=0;p<10;p++){
- str+=p
- }
- }console.log(str)
- //chess
|