add function to js