I have a form with several multiple-choice questions on a page and using serializeArray gives me an array like
[
{
name: "question1",
value: "a"
},
{
name: "question2",
value: "a"
},
{
name: "question3",
value: "b"
}
]
and so on (each question have answer options a, b and c).
How can I count the frequency of each answer (a, b and c) in the array and have the counts as variables (a = 2, b = 1 in the case above)?