1
1
import React from 'react' ;
2
2
import ReactDOM from 'react-dom' ;
3
3
//import PropTypes from 'prop-types';
4
+ var data = require ( './data.js' ) ;
4
5
5
- function shuffleArray ( array ) {
6
+ var shuffleArray = array => {
6
7
let i = array . length - 1 ;
7
8
for ( ; i > 0 ; i -- ) {
8
9
const j = Math . floor ( Math . random ( ) * ( i + 1 ) ) ;
@@ -15,13 +16,12 @@ function shuffleArray(array) {
15
16
class Quiz extends React . Component {
16
17
constructor ( props , context ) {
17
18
super ( props , context ) ;
18
- this . refreshQuestion = this . refreshQuestion . bind ( this )
19
+ this . refreshQuestion = this . refreshQuestion . bind ( this ) ;
19
20
this . state = {
20
21
change :false
21
22
}
22
23
}
23
24
refreshQuestion ( ) {
24
- console . log ( this ) ;
25
25
this . setState ( {
26
26
change :true
27
27
} )
@@ -97,42 +97,6 @@ class Answer extends React.Component{
97
97
98
98
}
99
99
100
- var data = [
101
- {
102
- question : "What is the Javscript compiler name in Google Chrome?" ,
103
- options : [ "Chrome V6" , "Chrome V7" , "Chrome V8" , "Chrome V9" ] ,
104
- key : "Chrome V8"
105
- } ,
106
- {
107
- question : "How can you detect the client's browser name?" ,
108
- options : [ "navigator.userAgent" , "navigator.browser" , "browser.appName" , "app.browserName" ] ,
109
- key : "navigator.userAgent"
110
- } ,
111
- {
112
- question : "Nearly all objects in JavaScript are instances of which of the following?" ,
113
- options : [ "Object" , "_proto_" , "Prototypes" , "DOM" ] ,
114
- key : "Object"
115
- } ,
116
- {
117
- question : "Which of the following is a correct way to empty an array?" ,
118
- options : [ "arrayName.empty();" , "arrayName.splice(0, arrayList.length);" , "arrayName = null;" , "arrayName = Obejct.empty();" ] ,
119
- key : "arrayName.splice(0, arrayList.length);"
120
- } ,
121
- {
122
- question : "Which of the following is not a React Component Lifecycle method?" ,
123
- options : [ "componentWillUpdate " , "componentDidUpdate " , "componentWillUnmount " , "componentGoingToUpdate" ] ,
124
- key : "componentGoingToUpdate"
125
- } ,
126
- {
127
- question : "In Experience Technology world, What does MEAN stand for?" ,
128
- options : [ "Mongodb, ES6, Angularjs and Node" ,
129
- "Mongodb, Ember, Angularjs and Node" ,
130
- "Mongodb, Express, Angularjs and Node" ,
131
- "Meteor, Express, Angularjs and Node" ] ,
132
- key : "Mongodb, Express, Angularjs and Node"
133
- }
134
- ]
135
-
136
100
// Quiz.PropTypes = {
137
101
// books: PropTypes.bool.isRequired,
138
102
// }
0 commit comments