improve  docs on JS function