Kristofer Koishigawa b3213fc892 fix(i18n): chinese test suite (#38220)
* fix: Chinese test suite

Add localeTiltes, descriptions, and adjust test text and testStrings to get the automated test suite working.

* fix: ran script, updated testStrings and solutions
2020-03-03 18:49:47 +05:30

62 lines
1.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
id: 587d7b7e367417b2b2512b22
title: Use the parseInt Function with a Radix
challengeType: 1
videoUrl: ''
localeTitle: 将parseInt函数与Radix一起使用
---
## Description
<section id="description"> <code>parseInt()</code>函数解析字符串并返回一个整数。它需要一个基数的第二个参数它指定字符串中数字的基数。基数可以是2到36之间的整数。函数调用如下 <code>parseInt(string, radix);</code>这是一个例子: <code>var a = parseInt(&quot;11&quot;, 2);</code>基数变量表示“11”在二进制系统或基数2中。此示例将字符串“11”转换为整数3。 </section>
## Instructions
<section id="instructions"><code>convertToInteger</code>函数中使用<code>parseInt()</code> ,以便将二进制数转换为整数并返回它。 </section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>convertToInteger</code>应该使用<code>parseInt()</code>函数
testString: assert(/parseInt/g.test(code));
- text: <code>convertToInteger(&quot;10011&quot;)</code>应该返回一个数字
testString: assert(typeof(convertToInteger("10011")) === "number");
- text: <code>convertToInteger(&quot;10011&quot;)</code>应该返回19
testString: assert(convertToInteger("10011") === 19);
- text: <code>convertToInteger(&quot;111001&quot;)</code>应该返回57
testString: assert(convertToInteger("111001") === 57);
- text: <code>convertToInteger(&quot;JamesBond&quot;)</code>应该返回NaN
testString: assert.isNaN(convertToInteger("JamesBond"));
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function convertToInteger(str) {
}
convertToInteger("10011");
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>