Functional API for javascript.