|
Download code/code021.jsonl from winapiadmin/tinycodinglm: direct link, hf CLI and curl.
- Browser
- Download file 2.16 kB
-
https://huggingface.co/datasets/winapiadmin/tinycodinglm/resolve/1464c23364f23349d4bfdab40fcdf171491d7c20/code/code021.jsonl
- Command line
-
hf download hf://datasets/winapiadmin/tinycodinglm@1464c23364f23349d4bfdab40fcdf171491d7c20/code/code021.jsonl
-
curl -L -o code021.jsonl https://huggingface.co/datasets/winapiadmin/tinycodinglm/resolve/1464c23364f23349d4bfdab40fcdf171491d7c20/code/code021.jsonl
2.16 kB
| {"type": "session", "harness": "deepseek-harness", "id": "code021", "name": "JavaScript best practices"} | |
| {"type": "message", "message": {"role": "system", "content": "You are an expert software engineer and technical assistant. You provide accurate, detailed, and practical answers. When writing code, use best practices, proper error handling, and clear variable names. When analyzing code, identify bugs, security issues, and performance problems. You have deep knowledge of C/C++, Windows API, Python, and many other technologies."}} | |
| {"type": "message", "message": {"role": "user", "content": "What are JavaScript best practices?"}} | |
| {"type": "message", "message": {"role": "assistant", "content": "**Modern JavaScript (ES6+):**\n```javascript\n// Use const by default, let when needed, never var\nconst API_URL = \"https://api.example.com\";\nlet count = 0;\n\n// Use arrow functions for callbacks\nitems.map(item => item.name);\n\n// Use template literals\nconst msg = `Hello ${name}`;\n\n// Use destructuring\nconst { id, name } = user;\nconst [first, ...rest] = array;\n\n// Use optional chaining\nconst city = user?.address?.city;\n\n// Use nullish coalescing\nconst value = input ?? defaultValue;\n```\n\n**Common Mistakes:**\n```javascript\n// Bad: loose equality\nif (x == \"0\") { }\nif (x == null) { }\n\n// Good: strict equality\nif (x === \"0\") { }\nif (x === null) { }\n```\n\n**Error Handling:**\n```javascript\n// Bad\ntry {\n await fetch(url);\n} catch (e) {} // swallows error\n\n// Good\ntry {\n await fetch(url);\n} catch (e) {\n console.error(\"Fetch failed:\", e);\n throw e;\n}\n```\n\n**Async/Await:**\n```javascript\n// Bad: callback hell\ngetData(function(a) {\n getMore(a, function(b) {\n getMore(b, function(c) { });\n });\n});\n\n// Good: async/await\nasync function getData() {\n const a = await getData();\n const b = await getMore(a);\n const c = await getMore(b);\n return c;\n}\n```\n\n**Performance:**\n- Use requestAnimationFrame for animations\n- Debounce/throttle event handlers\n- Use Web Workers for heavy computation\n- Lazy load images and components\n- Avoid memory leaks (clean up event listeners)"}} | |