I could be wrong, but I believe that OCaml's variable scoping more closely aligns with javascript's, let than var. I noticed that the code generated by the compiler in the comments uses var exclusively. I'd love to hear other people's thoughts on the matter.