A Java Script check is useful because it stops the form from being submitted if there is a problem, saving lots of time for your readers.
The CGI script is still more reliable, as it always works regardless of whether Java Script is enabled on the client-side or not; but having this extra safety barrier is a nice thing to have in place.
It makes your page much more user-friendly, and takes out the frustration of having to fill out the same form repeatedly.
It's also very precise, as you can point out the exact field where there's a problem.
In other words if the first condition fails, the second condition will not be tested and so forth.