Switching to numeric values would be much simpler. But to answer your question, it would be simple enough to have an object in JS in which the answer and its point value act as a key/value pair.
var q_points = {
"First Answer": 5,
"Second Answer": 10,
"Third Answer": 0,
"First Answer but to a different question": 5,
"and so on": 10
}
And then you could use the value of the question to pull the points. Assuming you included your answers on the JS function as parameters like "q1", "q2", etc, it might look like this:
var the_sum = q_points[q1] + q_points[q2] + ...
return the_sum
- Josh Carlson
Kendall County GIS