Commit 1b072faf authored by baesangjune's avatar baesangjune
Browse files

end 수정

parent d809327d
......@@ -5,21 +5,22 @@ import tr from './img_end.jpg';
// import { Link } from 'react-router-dom';
function End() {
let Scores = []
let Score = 0
JSON.parse(localStorage.getItem('Answers'))
for (let i = 0; i < 3; i++) {
let scores = []
let score = 0
const answers = JSON.parse(localStorage.getItem('Answers'))
const solutions = JSON.parse(localStorage.getItem('Solutions'))
for (let i = 0; i < answers.length ; i++) {
if (JSON.parse(localStorage.getItem('Answers'))[i] === JSON.parse(localStorage.getItem('Solutions'))[i]) {
if (answers[i] === solutions[i]) {
Scores[i] = 1
scores[i] = 1
}
else {
Scores[i] = 0
scores[i] = 0
}
Score += Scores[i]
score += scores[i]
}
return (
......@@ -30,17 +31,17 @@ function End() {
<div className='card-body'>
<h3 className='card-title'>이름 : {localStorage.getItem('name')}</h3>
{Scores.map(score => {
for (let i = 0; i < 3; i++) {
{scores.map((score, index) => {
if (score === 1) {
return <p className='card-text'>Quiz {(i + 1)} : 'O' </p>
return <p className='card-text'>Quiz {index+1} : 'O' </p>
}
else { return <p className='card-text'>Quiz {(i + 1)} : 'X' </p> }
else { return <p className='card-text'>Quiz {index+1} : 'X' </p> }
}
})}
<p className='card-text'>Total Score : {Score}</p>
<p className='card-text'>Total Score : {score}</p>
</div>
<div style={{ marginTop: '100px' }} className="Box text-center">
<img src={tr} alt="수고" />
......
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