You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
<!--
CO_OP_TRANSLATOR_METADATA:
{
"original_hash": "a4abf305ede1cfaadd56a8fab4b4c288",
"translation_date": "2025-08-24T00:05:52+00:00",
"source_file": "7-bank-project/3-data/assignment.md",
"language_code": "zh"
}
-->
# 重构并注释你的代码
## 说明
随着代码库的增长,定期重构代码对于保持其可读性和长期可维护性至关重要。通过添加注释并重构你的 `app.js` 来提升代码质量:
- 提取常量,例如服务器 API 基础 URL
- 将相似的代码进行整合:例如,你可以创建一个 `sendRequest()` 函数,将 `createAccount()` 和 `getAccount()` 中使用的代码集中起来
- 重新组织代码,使其更易于阅读,并添加注释
## 评分标准
| 标准 | 卓越 | 合格 | 需要改进 |
| -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- |
| | 代码已添加注释,分为不同部分且易于阅读。常量已提取,并创建了一个整合的 `sendRequest()` 函数。 | 代码整洁,但仍可通过添加更多注释、提取常量或整合代码来进一步优化。 | 代码混乱,未添加注释,常量未提取,代码未整合。 |
** 免责声明**:
本文档使用AI翻译服务 [Co-op Translator ](https://github.com/Azure/co-op-translator ) 进行翻译。尽管我们努力确保翻译的准确性,但请注意,自动翻译可能包含错误或不准确之处。应以原文档的原始语言版本为权威来源。对于关键信息,建议使用专业人工翻译。我们对因使用此翻译而引起的任何误解或误读不承担责任。