List.fold_left is compiled into a while loop in ocamlscript. The main reason that I used for loop is that the generated code is the same as hand written js, so the comparison is more reasonable<p>Edit: I am a practical programmer, I am in favor of both for loop and recursion as long as it is readable