I have two variables like Question_type and Answer_type in JavaScript.
I have a hidden_field with no value, I want to insert a value to the hidden_field by checking the conditions of Question_typeand Answer_type like the following:
If Question_type == 'A' && Answer_type == 'B' {
hidden_field = 1;
} else if Question_type == 'A' && Answer_type !== 'B' {
hidden_field = 2;
} else if Question_type !== 'A' && Answer_type == 'B' {
hidden_field = 3;
{ else if Question_type !== 'A' && Answer_type !== 'B' {
hidden_field = 4;
}
How to do this concept by short form or the clean method in JavaScript? Any JSfiddle example would be more appreiciated.