file.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. // html tree
  2. let body = {
  3. tagName: "body",
  4. subTags: [
  5. {tagName: 'div',
  6. subTags:[
  7. {tagName:'br'},
  8. {tagName:'span', text: 'Enter a data please:'},
  9. {tagName:'input', attrs:{type:'text', id:'name'}},
  10. {tagName:'input', attrs:{type:'text', id:'surname'}}
  11. ]},
  12. {tagName: 'div',
  13. subTags:[
  14. {tagName:'button', text:'OK', attrs:{id:'ok'}},
  15. {tagName:'button', text:'Cancel', attrs:{id:'cancel'}}
  16. ]}
  17. ]
  18. }
  19. body.subTags[1].subTags[1].text
  20. body.subTags[0].subTags[3].attrs.id
  21. // declarative fields
  22. let notebook = {
  23. brand: prompt('Enter brand'),
  24. type: prompt('Enter type'),
  25. model: prompt('Enter model'),
  26. ram: +prompt('Enter ram'),
  27. size: prompt('Size'),
  28. weight: +prompt('Weight'),
  29. resolution: {
  30. width: +prompt ('Width'),
  31. height: +prompt ('Height'),
  32. },
  33. };
  34. let phone = {
  35. brand: prompt('Enter brand'),
  36. model: prompt('Enter model'),
  37. ram: +prompt('Enter ram'),
  38. color: prompt('Enter color'),
  39. };
  40. let person = {
  41. name: prompt('Enter a name'),
  42. surname: prompt('Enter a surname'),
  43. married: confirm(),
  44. }
  45. // object links
  46. let person1 = {
  47. name:prompt('Enter a name'),
  48. smartphone:{ owner:person1},
  49. laptop:{ owner:person1}
  50. }
  51. // imperative array fill 3
  52. let array = [];
  53. array[0] = +prompt();
  54. array[1] = +prompt();
  55. array[2] = +prompt();
  56. // while confirm
  57. let qvestion = '';
  58. while(qvestion != true){
  59. qvestion = confirm('are you batman?')}
  60. // array fill
  61. let array1 = [];
  62. let filling = '';
  63. while(filling != null){
  64. filling = prompt('введите число'),
  65. array1.push(filling);
  66. }
  67. // array fill nopush\
  68. let array2 = [];
  69. let i = 0;
  70. let filling1 = '';
  71. while(filling1 != null){
  72. filling1 = prompt('введите число')
  73. array2[i] = filling1;
  74. i++
  75. }
  76. // infinite probability(?)
  77. let a = Math.random()
  78. let b = 0
  79. while( a < 0.9){
  80. b + 1;
  81. break;
  82. }
  83. // empty loop
  84. let value = '';
  85. while(value != prompt());
  86. // progression sum
  87. let sum = 0;
  88. for(i = 1; i < 50; i+=3){
  89. sum = sum + i}
  90. console.log(sum);
  91. // chess one line
  92. let c = '';
  93. for(y = 0;y < 21;y++){
  94. if(y % 2 === 1){
  95. c = c + '#'}
  96. else {
  97. c = c + ' '}}
  98. // numbers
  99. let x = ""
  100. for (let i = 0; i < 10; i++){
  101. x = x + "\n"
  102. for (let i = 0; i < 1; i++){
  103. x = x + 0
  104. for (let i = 0; i < 1; i++){
  105. x = x + 1
  106. for (let i = 0; i < 1; i++){
  107. x = x + 2
  108. for (let i = 0; i < 1; i++){
  109. x = x + 3
  110. for (let i = 0; i < 1; i++){
  111. x = x + 4
  112. for (let i = 0; i < 1; i++){
  113. x = x + 5
  114. for (let i = 0; i < 1; i++){
  115. x = x + 6
  116. for (let i = 0; i < 1; i++){
  117. x = x + 7
  118. for (let i = 0; i < 1; i++){
  119. x = x + 8
  120. for (let i = 0; i < 1; i++){
  121. x = x + 9
  122. }
  123. }
  124. }
  125. }
  126. }
  127. }
  128. }
  129. }
  130. }
  131. }
  132. }
  133. console.log(x)
  134. // chess(??????????)<
  135. // cubes(?????????)
  136. // multiply table(???????)
  137. // matrix to html table(????????)
  138. // не понял с этого задания>