javascript: Remove trailing semicolon from function snippet