common js function