Add snippet to javascript