Commit 5b4f23dc authored by baesangjune's avatar baesangjune
Browse files

.

parent c3ab49b5
......@@ -5,6 +5,7 @@ import React from 'react'
// import { Link } from 'react-router-dom';
function End() {
let result = ''
let scores = []
let score = 0
const answers = JSON.parse(localStorage.getItem('Answers'))
......@@ -16,11 +17,17 @@ function End() {
scores[i] = 1
}
else if (answers[i] === 0) {
scores[i] = -1
}
else {
scores[i] = 0
}
score += scores[i]
if (score <0){
score =0
}
}
return (
......@@ -37,7 +44,17 @@ function End() {
<tbody>
{scores.map((score, index) => {
return (score === 1) ? <tr><td>Quiz {index + 1}</td> <td> O </td></tr> : <tr><td>Quiz {index + 1}</td> <td> X</td></tr>
if (score === -1) {
result = <tr><td>Quiz {index + 1}</td> <td> 정답이 입력되지 않았습니다. </td></tr>
}
else if (score === 1) {
result = <tr><td>Quiz {index + 1}</td> <td> O </td></tr>
}
else {
result = <tr><td>Quiz {index + 1}</td> <td> X</td></tr>
}
return result
})}
<tr>
<td>총점</td>
......
......@@ -6,9 +6,9 @@ import logo from './img_question.png'
const QnA = [
{ Q: "6 X 4 = ?", Choose: [6, 12, 18, 24], A: "4", N: 1 },
{ Q: "3 + 3 = ?", Choose: [2, 4, 6, 8], A: "3", N: 2 },
{ Q: "3 - 1 = ?", Choose: [1, 2, 3, 4], A: "2", N: 3 }
{ Q: "6 X 4 = ?", Choose: [6, 12, 18, 24], N: 1 },
{ Q: "3 + 3 = ?", Choose: [2, 4, 6, 8], N: 2 },
{ Q: "3 - 1 = ?", Choose: [1, 2, 3, 4], N: 3 }
]
let Answers = [0,0,0]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment