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 6711545
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:09:11+00:00 2026-05-26T08:09:11+00:00

For a school project, I’m making a webapp that presents a dichotomous key .

  • 0

For a school project, I’m making a webapp that presents a dichotomous key.

First, it shows a list of possible items. The user picks one in their head. The app then presents the user with a question and buttons for Yes or No. A new question is asked based on the response to the previous one. This continues until only one item fits the user’s responses.

My question is how to store the data. My initial idea was a nested array. Here’s an example using fruits:

Options: Apple, Orange, Banana, Pear

0 - "Is it shaped like a sphere?"           Initial question
1 -                                         Yes response
    0 - "Do you eat the peel/skin?"         Subsequent question
    1 - "Apple"                             Answer based on Yes response
    2 - "Orange"                            Answer based on No response
2 -                                         No response to initial
    0 - "Is it yellow                       Subsequent question
    1 - "Banana"                            Answer based on Yes response
    2 - "Pear"                              Answer based on No response

But, this way seems like it could get pretty unwieldy with a lot of data. Is there a better way to structure this?

This has to be completely JS/HTML; I don’t want to use a database or anything like that.

  • 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-05-26T08:09:12+00:00Added an answer on May 26, 2026 at 8:09 am

    I’d suggest using a table like this (technically, it can be an array of objects)

                                    Apple Orange Banana Pear
    Is it shaped like a sphere?     +     +      -      -
    Do you eat the peel/skin?       +     -      -      +
    Is it yellow?                   -     -      +      -
    

    It is more flexible compared to nested objects or graphs because you can determine questions and their order dynamically, depending on what items are selected.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For a school project we're developing a game that's a little like Conway's game
For my school project, I would like to build a gui that someone else
I am doing a school project regarding a small website that uses php. I
I'm making minesweeper for a school project. When the player wins or loses, the
My question is about a school project that I'm working on. It involves mapping
Im working in a school project. I want the user to select categories to
for a school project, I am making a chessboard in java. there were certain
I have multiple python files for a school project that I want to open
I am making a fraction class for a school project, and my brain is
for a school project i'm making a jigsaw puzzle out of javascript and jquery.

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.