I am wanting to make a character personality test(for my fictional characters)
I know I am going to have to have variables equaling arrays like this:
// var personality = [gender, age, muscularity, trait_1, trait_2, etc.];
I know the variable = array
isn't working so I commented it out. I am going to need variables for each question and a lot of if/else if/else statements.
I start with an alert()
statement where I ask the question "What is your gender?" I think I need to change this to prompt()
for it to accept an answer.
But how am I going to get all these var = "string"
and if/else
statements and var = [array]
statements into a reasonable, pure JS personality test?
I know the plan(gender first, then age, then other physical characteristics, then socio-emotional characteristics, then other characteristics)
but I need some help here.
I know that the if/elseif/else
statements would lead to more and more prompts and some would be male specific and some would be female specific. So I would have all these nested statements like this:
if (variable = "string") {
prompt("Next question");
var a(generic variable that could refer to anything) = [array(prompt results)];
} else {
prompt("Next question");
var b(again generic variable) = [array(prompt results)];
}
etc.
So how could I get the arrays to have the possible results and if what is typed in is undefined(out of the array) not allow it to continue?
And how could I get this last personality array to take all previous variables into consideration and have particular combinations equal particular personalities without n * 10^x if/else statements?