So I see a lot of JavaScript code (have written some myself) that does something like
I think a lot of times when you see this code, it's from people who are in the habit of event handlers for forms, buttons, inputs, and things of that sort.
Basically, when you have something like:
or
`
and callSomeFunction() returns true, then the form or a will submit, otherwise it won't.
Other more obvious general purposes for returning true or false as a result of a function are because they are expected to return a boolean.