Count fields in dataset and display in textbox

Hello,

I am trying to count the number of "W"s in my collection and display that number in a textbox. I have some experience in other languages but I am lost when it comes to Javascript. Here are the identifiers for my request.

Collection name: Plays
Collection field: Result
Textbox: textResults

Can someone please provide code or walk me through how to accomplish this?

Thank you!