So far, I have:
$('.the-inputs input').each(function() {
userAnswer = $(this).val();
});
However, if I console.log this out, it comes out on separate lines (is this an array?) I would like it as a string.
So, if the user enters "Hello" "World" in the two inputs, I want the variable userAnswer = "Hello World".
I also need the variable accessible outside the function. Am I right in leaving off the var to achieve this?
vardeclaration only determines wether its a global variable or only in the functionscope. Either way, each illitaration of the each-loop will overwrite it to$(this).val()