SHARE
TWEET

Untitled

a guest Nov 4th, 2010 279 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script language=javascript>
  2.         function factorial( val, is_transient)
  3.         {
  4.                 var ret =  val ==  1 ?  1 :   factorial( val-1, 1) * val;
  5.                 if ( ! is_transient) {
  6.                         document. write( "factorial of " +   val + " is: " + ret +  "<br>") ;
  7.                 } ;
  8.         } ;
  9.         factorial( 6, 0) ;
  10.         factorial( 3, 0) ;
  11.         factorial( 9, 0) ;
  12. </script>
RAW Paste Data
Want to get better at JavaScript?
Learn to code JavaScript in 2017
Pastebin PRO Summer Special!
Get 40% OFF on Pastebin PRO accounts!
Top