Function didn't return any value, is that valid?

Hi,

I built a rock paper scissors game based on freeCodeCamp tutorial “Web Development Tutorial - JavaScript, HTML, CSS - Rock Paper Scissors Game”.

It works perfectly, here is the demo and code.

My question is two of my functions, game and displayResult, didn’t return any value. Is that valid? If no, how should I improve it.

Thanks in advance.

Functions do not always need to return a value. You will sometimes hear these referred to as “void functions”.

3 Likes

I see, thank you so much!