test2 / script.js
SG34's picture
Create script.js
ecbf8f2 verified
Raw History Blame Contribute Delete
3.03 kB
const questions = [
"μƒˆλ‘œμš΄ μ‚¬λžŒλ“€κ³Ό μ‰½κ²Œ μ–΄μšΈλ¦¬λ‚˜μš”?",
"세뢀사항보닀 큰 그림을 보렀고 ν•˜λ‚˜μš”?",
"논리적이고 객관적인 결정을 내리렀고 ν•˜λ‚˜μš”?",
"일정을 잘 κ³„νšν•˜κ³  λ”°λ₯΄λŠ” νŽΈμΈκ°€μš”?",
"λ‹€μ–‘ν•œ κ°€λŠ₯성을 μƒμƒν•˜λ©° μƒκ°ν•˜λŠ” 것을 μ’‹μ•„ν•˜λ‚˜μš”?",
"μƒλŒ€λ°©μ˜ 감정에 λ―Όκ°ν•œκ°€μš”?",
"즉ν₯적으둜 ν–‰λ™ν•˜λŠ” 것을 μ¦κΈ°λ‚˜μš”?",
"λŒ€ν™” 쀑 μžμ‹ μ΄ 말보닀 μƒλŒ€λ°©μ˜ 말을 더 많이 λ“£λ‚˜μš”?",
"미래의 κ°€λŠ₯성보닀 ν˜„μž¬μ˜ 사싀에 μ§‘μ€‘ν•˜λ‚˜μš”?",
"κ°ˆλ“± μƒν™©μ—μ„œ μ‚¬λžŒλ“€μ˜ μ‘°ν™”λ₯Ό μš°μ„ μ‹œν•˜λ‚˜μš”?",
"혼자만의 μ‹œκ°„μ„ μ€‘μš”ν•˜κ²Œ μƒκ°ν•˜λ‚˜μš”?",
"μžμ‹ μ˜ 감정을 잘 ν‘œν˜„ν•˜λ‚˜μš”?",
"λ³΅μž‘ν•œ 문제λ₯Ό λ…Όλ¦¬μ μœΌλ‘œ λΆ„μ„ν•˜λŠ” 것을 μ¦κΈ°λ‚˜μš”?",
"κ·œμΉ™κ³Ό 절차λ₯Ό λ”°λ₯΄λŠ” 것을 μ„ ν˜Έν•˜λ‚˜μš”?",
"μƒˆλ‘œμš΄ ν™˜κ²½μ—μ„œ λΉ λ₯΄κ²Œ μ μ‘ν•˜λ‚˜μš”?",
"세뢀사항보닀 큰 그림에 더 μ§‘μ€‘ν•˜λ‚˜μš”?",
"λ‹€λ₯Έ μ‚¬λžŒμ˜ 감정에 κ³΅κ°ν•˜λŠ” νŽΈμΈκ°€μš”?",
"마감 μ‹œκ°„ 전에 일을 λλ‚΄λŠ” 것을 μ€‘μš”ν•˜κ²Œ μƒκ°ν•˜λ‚˜μš”?",
"μ‚¬λžŒλ“€κ³Όμ˜ 관계가 μžμ‹ μ—κ²Œ μ€‘μš”ν•œκ°€μš”?",
"μžμ‹ μ˜ μ˜κ²¬μ„ ν‘œν˜„ν•  λ•Œ 논리적인 이유λ₯Ό μ€‘μ‹œν•˜λ‚˜μš”?",
"μ‹€μ œ κ²½ν—˜μ„ 톡해 λ°°μš°λŠ” 것을 μ„ ν˜Έν•˜λ‚˜μš”?",
];
let currentQuestion = 0;
let answers = [];
function selectAnswer(answer) {
answers.push(answer);
currentQuestion++;
if (currentQuestion < questions.length) {
showQuestion();
} else {
showResult();
}
}
function showQuestion() {
document.getElementById("question-text").textContent = questions[currentQuestion];
document.getElementById("question-number").textContent = currentQuestion + 1;
}
function showResult() {
const resultContainer = document.getElementById("result-container");
const questionContainer = document.getElementById("question-container");
questionContainer.classList.add("hidden");
resultContainer.classList.remove("hidden");
// κ²°κ³Ό 계산 둜직
const mbtiTypes = ["INTJ", "ENFP", "INFJ", "ENTP", "ISTJ"];
const randomType = mbtiTypes[Math.floor(Math.random() * mbtiTypes.length)];
document.getElementById("mbti-type").textContent = `MBTI μœ ν˜•: ${randomType}`;
document.getElementById("mbti-description").textContent = "성격 μ„€λͺ…은 여기에 ν‘œμ‹œλ©λ‹ˆλ‹€.";
document.getElementById("mbti-jobs").textContent = "μΆ”μ²œ 직업: 개발자, λ””μžμ΄λ„ˆ";
document.getElementById("mbti-tips").textContent = "μžμ‚° 관리 μš”λ Ή: κ³„νšμ μœΌλ‘œ νˆ¬μžν•˜μ„Έμš”.";
document.getElementById("mbti-image").src = "https://via.placeholder.com/150";
}
function restartQuiz() {
currentQuestion = 0;
answers = [];
document.getElementById("question-container").classList.remove("hidden");
document.getElementById("result-container").classList.add("hidden");
showQuestion();
}
// μ΄ˆκΈ°ν™”
showQuestion();