how to find factorial using javascript