Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7939101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:59:51+00:00 2026-06-03T22:59:51+00:00

I have this dataset at the moment that I am using for a quiz

  • 0

I have this dataset at the moment that I am using for a quiz application (how bad is it?):

   var questions =
        [
        'Question 1 text', 
        'Question 2 text'
        ]

    var answers =
        // Question 0
        [
            ['Choice 0', // Right answer
            'Choice 1',
            'Choice 2']
        ]
        // Question 1
        [
            ['Choice 0',
            'Choice 1', // Right answer
            'Choice 2']
        ]

    var correctChoice = 
        [
        '0', // Question 0, choice 0
        '1' //  Question 1, choice 1
        ]

So I am relying on the “invisible index” to link them all together, which is kinda hard to maintain.
Is there a better way to go about this? Are objects better? Recommendations, or best practices in general?

I have been thinking about JSON – would that be a good alternative?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T22:59:53+00:00Added an answer on June 3, 2026 at 10:59 pm

    Something like this should do:

    var quiz = [
      {question: 'Question 1 text', answers: ['answer 1', 'answer 2'], correct: 0},
      {question: 'Question 2 text', answers: ['answer 1', 'answer 2'], correct: 1}
    ];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created Windows Application. In this, I have multiple tables in dataset, now
i have text file that looks like this: 1 \t a 2 \t b
Lets say that I have this records in a dataset: name1 XXXXX XXXXXX name1
I have this code so I can grab the values ind the dataset before
I have a DataSet with some Datatables and I am saving this DataSet as
I have the dataset (pts) like this: x <- seq(-124.25,length=115,by=0.5) y <- seq(26.25,length=46,by=0.5) z
This is the code I have: Sub Main() Dim dts As New DataSet Dim
I have fit a simple bi-variate VAR model to this data set and I
I have a data set that resembles this: id product_id size color price created_date
I have an automated script that generates a graph every day using GNUPlot. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.