Changed around line 1
+ const quizData = [
+ {
+ question: "What type of work environment do you prefer?",
+ options: [
+ { text: "Structured and organized", path: "corporate" },
+ { text: "Creative and flexible", path: "creative" },
+ { text: "Fast-paced and challenging", path: "startup" }
+ ]
+ },
+ {
+ question: "What are you most passionate about?",
+ options: [
+ { text: "Helping others", path: "helping" },
+ { text: "Solving complex problems", path: "problem-solving" },
+ { text: "Creating new things", path: "creating" }
+ ]
+ },
+ {
+ question: "What's your ideal work style?",
+ options: [
+ { text: "Team collaboration", path: "team" },
+ { text: "Independent work", path: "independent" },
+ { text: "Leadership roles", path: "leadership" }
+ ]
+ }
+ ];
+
+ const careerPaths = {
+ corporate: {
+ helping: ["Human Resources", "Corporate Training"],
+ "problem-solving": ["Management Consulting", "Financial Analysis"],
+ creating: ["Product Management", "Corporate Strategy"]
+ },
+ creative: {
+ helping: ["Graphic Design", "UI/UX Design"],
+ "problem-solving": ["Creative Direction", "Advertising"],
+ creating: ["Content Creation", "Art Direction"]
+ },
+ startup: {
+ helping: ["Customer Success", "Community Management"],
+ "problem-solving": ["Data Science", "Software Engineering"],
+ creating: ["Entrepreneurship", "Product Development"]
+ }
+ };
+
+ let currentQuestion = 0;
+ let userPath = [];
+
+ const startBtn = document.getElementById('startBtn');
+ const quizSection = document.getElementById('quiz');
+ const questionEl = document.getElementById('question');
+ const optionsEl = document.getElementById('options');
+ const backBtn = document.getElementById('backBtn');
+ const resultsSection = document.getElementById('results');
+ const resultContent = document.getElementById('resultContent');
+ const restartBtn = document.getElementById('restartBtn');
+
+ startBtn.addEventListener('click', startQuiz);
+ backBtn.addEventListener('click', previousQuestion);
+ restartBtn.addEventListener('click', restartQuiz);
+
+ function startQuiz() {
+ document.getElementById('intro').classList.add('hidden');
+ quizSection.classList.remove('hidden');
+ loadQuestion();
+ }
+
+ function loadQuestion() {
+ const currentQuizData = quizData[currentQuestion];
+ questionEl.textContent = currentQuizData.question;
+ optionsEl.innerHTML = '';
+
+ currentQuizData.options.forEach(option => {
+ const button = document.createElement('div');
+ button.classList.add('option');
+ button.textContent = option.text;
+ button.addEventListener('click', () => selectOption(option.path));
+ optionsEl.appendChild(button);
+ });
+
+ backBtn.classList.toggle('hidden', currentQuestion === 0);
+ }
+
+ function selectOption(path) {
+ userPath.push(path);
+ if (currentQuestion < quizData.length - 1) {
+ currentQuestion++;
+ loadQuestion();
+ } else {
+ showResults();
+ }
+ }
+
+ function previousQuestion() {
+ if (currentQuestion > 0) {
+ currentQuestion--;
+ userPath.pop();
+ loadQuestion();
+ }
+ }
+
+ function showResults() {
+ quizSection.classList.add('hidden');
+ resultsSection.classList.remove('hidden');
+
+ const [environment, passion, workStyle] = userPath;
+ const possibleCareers = careerPaths[environment][passion];
+
+ resultContent.innerHTML = `
+
Based on your preferences, here are some career paths to consider:
+ ${possibleCareers.map(career => `
${career}`).join('')}+
+
Remember, this is just a starting point. Explore these options further to find your perfect fit!
+ `;
+ }
+
+ function restartQuiz() {
+ currentQuestion = 0;
+ userPath = [];
+ resultsSection.classList.add('hidden');
+ quizSection.classList.remove('hidden');
+ loadQuestion();
+ }