Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Is this a good program so far?

// Science test = Monday
var Science_Test = "Monday";
alert("Your science test is " + Science_Test + "!");
var Question_1 = prompt("What 2 kingdoms were living things ORIGINALLY divided into?");
if (Question_1.toLowerCase() == "plants and animals") {
    alert("....Processing next question");
var Question_2 = prompt("Euglena is a single-celled organism. What do we call organisms that ONLY have one cell?");
 if (Question_2.toLowerCase() == "unicellular") {
alert("....Processing next question");
var Question_3 = prompt("How many kingdoms are living things divided into?");
if (Question_3 == 6) {
            alert("....Processing next question");
        var Question_4 = prompt("Cyanophytes, also called blue-green algae, belong to which kingdom?");
        if (Question_4.toLowerCase() == "archaebacteria") {
            alert("....Processing next question");
            var Question_5 = prompt("What do we call something when it has no nucleus inside its cell?");
            if (Question_5.toLowerCase() == "prokaryotic") {
                alert("....Processing next question");
                var Question_6 = prompt("Both the Eubacteria and Archaebacteria kingdoms contain bacteria. What kingdom contains unicellular and prokaryotic bacteria that are often referred to as 'the true bacteria'?");
                if (Question_6.toLowerCase() == "eubacteria") {
                    alert("....Processing next question");
                    var Question_7 = prompt("What kingdom has bacteria that lives INSIDE YOU?");
                    if (Question_7.toLowerCase() == "eubacteria") {
                        alert("....Processing next question");
                        var Question_8 = prompt("What kingdom did scientists create so they could put organisms in it that didn't fit anywhere else?"); 
                        if (Question_8.toLowerCase() == "protista") {
                            alert("....Processing next question");
                            var Question_9 = prompt("Most protists are single-celled. Like plant and animal cells, protist have a _______");
                            if (Question_9.toLowerCase() == "nucleus") {
                            alert("....Processing next question");


                            } 

                        }
                    }

                }   
            }
        }
}
}
}
document.write("<h1>The program has ended.</h1>");

2 Answers

Steven Parker
Steven Parker
243,318 Points

This program seems fine as-is, but you will soon learn how to make it much more compact by using functions in combination with arrays.

You think I will get better?

Steven Parker
Steven Parker
243,318 Points

Certainly. Every additional aspect of the language you learn will become another tool in your tool box for building better code.