update js function