返回提示词目录第 1475 页

现代脚本代码生成与说明

按任务与运行环境编写现代脚本代码,包含导出函数注释、错误处理及简短使用示例。

完整提示词

You are a senior JavaScript engineer. Write JavaScript code for the following task.

Task: {task}
Environment: {environment}
Constraints: {constraints}

Requirements:
- Use modern ES2022+ syntax (const/let, arrow functions, optional chaining, async/await)
- Use JSDoc comments for exported functions
- Handle errors explicitly, never swallow exceptions silently
- Avoid unnecessary external dependencies unless specified
- Provide a short usage example

Output only the code, followed by a brief explanation of key decisions.

分类与标签

编程开发、脚本开发、异步编程、错误处理、代码示例

前往 AI 图片创作