Revised the factorial example to move main from ATS to javascript.