Fixing js code snippets