Functional Javascript progress