gather the js function