@@ -60,64 +60,68 @@ console.log(regExpEndParse(someWebpackModule, regExpSetpoint, regExpRequiredValu
6060
6161
6262//Task3
63- window . onload = function ( ) {
64- let app = {
65- questions : [
66- { textQuestions :'Вопрос №1' ,
67- textAnswers : [ 'Вариант ответа №1' , 'Вариант ответа №2' , 'Вариант ответа №3' ] } ,
68- { textQuestions :'Вопрос №2' ,
69- textAnswers : [ 'Вариант ответа №1' , 'Вариант ответа №2' , 'Вариант ответа №3' ] } ,
70- { textQuestions :'Вопрос №3' ,
71- textAnswers : [ 'Вариант ответа №1' , 'Вариант ответа №2' , 'Вариант ответа №3' ] }
72- ] ,
73- createContainer ( ) {
74- let conteiner = document . createElement ( 'article' ) ;
75- conteiner . appendChild ( this . createCaption ( ) ) ;
76- conteiner . appendChild ( this . createQuestions ( ) ) ;
77- conteiner . appendChild ( this . createButton ( ) ) ;
78- return conteiner ;
63+ let app = {
64+ questions : [
65+ {
66+ textQuestions :'Вопрос №1' ,
67+ textAnswers : [ 'Вариант ответа №1' , 'Вариант ответа №2' , 'Вариант ответа №3' ]
7968 } ,
80- createCaption ( ) {
81- let caption = document . createElement ( 'h1' ) ;
82- caption . textContent = 'Тест по програмированию' ;
83- return caption ;
69+ {
70+ textQuestions :'Вопрос №2' ,
71+ textAnswers : [ 'Вариант ответа №1' , 'Вариант ответа №2' , 'Вариант ответа №3' ]
8472 } ,
85- createQuestions ( ) {
86- let id = 0 ;
87- let list = document . createElement ( 'ol' ) ;
88- this . questions . forEach ( ( questAnswer ) => {
89- let question = document . createElement ( 'li' ) ;
90- question . textContent = questAnswer . textQuestions ;
91- let sectionAnswer = document . createElement ( 'section' ) ;
92- question . appendChild ( sectionAnswer ) ;
93-
94- questAnswer . textAnswers . forEach ( ( elem ) => {
95- let idId = id ++ ;
96- let answer = document . createElement ( 'p' ) ;
97- let input = document . createElement ( 'input' ) ;
98- input . setAttribute ( 'type' , 'checkbox' ) ;
99- input . setAttribute ( 'id' , `check${ idId } ` ) ;
100- let label = document . createElement ( 'label' ) ;
101- label . setAttribute ( 'for' , `check${ idId } ` ) ;
102- label . textContent = elem ;
103- answer . appendChild ( input ) ;
104- answer . appendChild ( label ) ;
105-
106- sectionAnswer . appendChild ( answer ) ;
107- question . appendChild ( sectionAnswer ) ;
108- list . appendChild ( question ) ;
109- } ) ;
110- } ) ;
111- return list ;
112- } ,
113- createButton ( ) {
114- let button = document . createElement ( 'button' ) ;
115- button . textContent = 'Проверить мои результаты' ;
116- return button ;
117- } ,
118- render ( ) {
119- document . body . appendChild ( this . createContainer ( ) ) ;
73+ {
74+ textQuestions :'Вопрос №3' ,
75+ textAnswers : [ 'Вариант ответа №1' , 'Вариант ответа №2' , 'Вариант ответа №3' ]
12076 }
121- } ;
122- app . render ( ) ;
77+ ] ,
78+ createContainer ( ) {
79+ let container = document . createElement ( 'article' ) ;
80+ container . appendChild ( this . createCaption ( ) ) ;
81+ container . appendChild ( this . createQuestions ( ) ) ;
82+ container . appendChild ( this . createButton ( ) ) ;
83+ return container ;
84+ } ,
85+ createCaption ( ) {
86+ let caption = document . createElement ( 'h1' ) ;
87+ caption . textContent = 'Тест по програмированию' ;
88+ return caption ;
89+ } ,
90+ createQuestions ( ) {
91+ let id = 0 ;
92+ let list = document . createElement ( 'ol' ) ;
93+ this . questions . forEach ( ( questAnswer ) => {
94+ let question = document . createElement ( 'li' ) ;
95+ question . textContent = questAnswer . textQuestions ;
96+ let sectionAnswer = document . createElement ( 'section' ) ;
97+ question . appendChild ( sectionAnswer ) ;
98+
99+ questAnswer . textAnswers . forEach ( ( elem ) => {
100+ let idId = id ++ ;
101+ let answer = document . createElement ( 'p' ) ;
102+ let input = document . createElement ( 'input' ) ;
103+ input . setAttribute ( 'type' , 'checkbox' ) ;
104+ input . setAttribute ( 'id' , `check${ idId } ` ) ;
105+ let label = document . createElement ( 'label' ) ;
106+ label . setAttribute ( 'for' , `check${ idId } ` ) ;
107+ label . textContent = elem ;
108+ answer . appendChild ( input ) ;
109+ answer . appendChild ( label ) ;
110+
111+ sectionAnswer . appendChild ( answer ) ;
112+ question . appendChild ( sectionAnswer ) ;
113+ list . appendChild ( question ) ;
114+ } ) ;
115+ } ) ;
116+ return list ;
117+ } ,
118+ createButton ( ) {
119+ let button = document . createElement ( 'button' ) ;
120+ button . textContent = 'Проверить мои результаты' ;
121+ return button ;
122+ } ,
123+ render ( ) {
124+ document . body . appendChild ( this . createContainer ( ) ) ;
125+ }
123126} ;
127+ app . render ( ) ;
0 commit comments