While not directly address in renatoargh's answer, the answer to your first question is technically yes. If you need to return a result from an in/else block that is how it is done.
However, when the intent is to return a boolean value, you should not use if/else blocks at all. The boolean expression used within the else clause can be directly returned instead of explicitly returning true
or false
.
Note: Javascript is one of the easiest languages to execute these days and check to see how it is executing. Your second question implies that you are not sure if the code it executing properly. It is very straight forward to call this function with an argument you expect to return true and one you expect yo return false. This will tell you if things are working properly. You don't need to be afraid to get your feet wet and run the code you have written.