65 lines
2.8 KiB
Markdown
65 lines
2.8 KiB
Markdown
|
---
|
|||
|
id: 587d8249367417b2b2512c41
|
|||
|
title: Metric-Imperial Converter
|
|||
|
challengeType: 4
|
|||
|
isRequired: true
|
|||
|
videoUrl: ''
|
|||
|
localeTitle: 公制 - 英制转换器
|
|||
|
---
|
|||
|
|
|||
|
## Description
|
|||
|
<section id="description">构建一个功能类似于此的完整堆栈JavaScript应用程序: <a href="https://hard-twilight.glitch.me/" target="_blank">https</a> : <a href="https://hard-twilight.glitch.me/" target="_blank">//hard-twilight.glitch.me/</a> 。在这个项目上工作将涉及您在我们的入门项目上在Glitch上编写代码。完成此项目后,您可以将公共故障网址(到应用程序的主页)复制到此屏幕进行测试!您可以选择在另一个平台上编写项目,但必须公开显示我们的测试。使用<a href="https://glitch.com/#!/import/github/freeCodeCamp/boilerplate-project-metricimpconverter/">此链接</a>在Glitch上启动此项目或在GitHub上克隆<a href="https://github.com/freeCodeCamp/boilerplate-project-metricimpconverter/">此存储库</a> !如果您使用Glitch,请记住将项目链接保存到安全的地方! </section>
|
|||
|
|
|||
|
## Instructions
|
|||
|
<section id="instructions">
|
|||
|
</section>
|
|||
|
|
|||
|
## Tests
|
|||
|
<section id='tests'>
|
|||
|
|
|||
|
```yml
|
|||
|
tests:
|
|||
|
- text: 我将阻止客户端尝试猜测(嗅探)MIME类型。
|
|||
|
testString: ''
|
|||
|
- text: 我会阻止跨站点脚本(XSS)攻击。
|
|||
|
testString: ''
|
|||
|
- text: 我可以使用包含可接受的数字和单位的单个参数进行GET / api / convert并将其转换。 (提示:通过查找将标记单元开头的第一个字符的索引来拆分输入)
|
|||
|
testString: ''
|
|||
|
- text: 我可以将'gal'转换为'L',反之亦然。 (1加仑到3.78541升)
|
|||
|
testString: ''
|
|||
|
- text: 我可以将'lbs'转换为'kg',反之亦然。 (1磅至0.453592千克)
|
|||
|
testString: ''
|
|||
|
- text: 我可以将'mi'转换为'km',反之亦然。 (1英里到1.60934公里)
|
|||
|
testString: ''
|
|||
|
- text: 如果我的计量单位无效,则返回“无效单位”。
|
|||
|
testString: ''
|
|||
|
- text: 如果我的号码无效,则返回“无效号码”。
|
|||
|
testString: ''
|
|||
|
- text: 如果两者都无效,则返回“无效数字和单位”。
|
|||
|
testString: ''
|
|||
|
- text: '我可以在我的参数中使用分数,小数或两者(即5,1 / 2,2.5 / 6),但如果没有提供,则默认为1。'
|
|||
|
testString: ''
|
|||
|
- text: '我的返回将包含initNum,initUnit,returnNum,returnUnit和字符串拼写单元,格式为“{initNum} {initial_Units}转换为{returnNum} {return_Units}”,结果舍入为字符串中的5位小数。'
|
|||
|
testString: ''
|
|||
|
- text: 所有16个单元测试都已完成并通过。
|
|||
|
testString: ''
|
|||
|
- text: 所有5个功能测试都已完成并通过。
|
|||
|
testString: ''
|
|||
|
|
|||
|
```
|
|||
|
|
|||
|
</section>
|
|||
|
|
|||
|
## Challenge Seed
|
|||
|
<section id='challengeSeed'>
|
|||
|
|
|||
|
</section>
|
|||
|
|
|||
|
## Solution
|
|||
|
<section id='solution'>
|
|||
|
|
|||
|
```js
|
|||
|
// solution required
|
|||
|
```
|
|||
|
</section>
|