add js function snippet