Files
.github
api-server
client
config
curriculum
challenges
_meta
arabic
chinese
01-responsive-web-design
02-javascript-algorithms-and-data-structures
basic-algorithm-scripting
boo-who.chinese.md
chunky-monkey.chinese.md
confirm-the-ending.chinese.md
convert-celsius-to-fahrenheit.chinese.md
factorialize-a-number.chinese.md
falsy-bouncer.chinese.md
find-the-longest-word-in-a-string.chinese.md
finders-keepers.chinese.md
mutations.chinese.md
repeat-a-string-repeat-a-string.chinese.md
return-largest-numbers-in-arrays.chinese.md
reverse-a-string.chinese.md
slice-and-splice.chinese.md
title-case-a-sentence.chinese.md
truncate-a-string.chinese.md
where-do-i-belong.chinese.md
basic-data-structures
basic-javascript
debugging
es6
functional-programming
intermediate-algorithm-scripting
javascript-algorithms-and-data-structures-projects
object-oriented-programming
regular-expressions
03-front-end-libraries
04-data-visualization
05-apis-and-microservices
06-information-security-and-quality-assurance
08-coding-interview-prep
09-certificates
english
portuguese
russian
spanish
schema
test
.babelrc
.editorconfig
.npmignore
.travis.yml
CHANGELOG.md
LICENSE.md
commitizen.config.js
commitlint.config.js
create-challenge-bundle.js
getChallenges.js
gulpfile.js
lib.js
package-entry.js
package-lock.json
package.json
utils.js
cypress
docs
search-indexing
tools
utils
.editorconfig
.eslintignore
.eslintrc.json
.gitattributes
.gitignore
.gitpod.yml
.node-inspectorrc
.npmrc
.prettierignore
.prettierrc
.snyk
.travis.yml
.vcmrc
CODE_OF_CONDUCT.md
CONTRIBUTING.md
Dockerfile.tests
HoF.md
LICENSE.md
README.md
SECURITY.md
change_volumes_owner.sh
cypress-install.js
cypress.json
docker-compose-shared.yml
docker-compose.tests.yml
docker-compose.yml
jest.config.js
lerna.json
package-lock.json
package.json
sample.env
freeCodeCamp/curriculum/challenges/chinese/02-javascript-algorithms-and-data-structures/basic-algorithm-scripting/find-the-longest-word-in-a-string.chinese.md

66 lines
2.2 KiB
Markdown
Raw Normal View History

---
id: a26cbbe9ad8655a977e1ceb5
title: Find the Longest Word in a String
isRequired: true
challengeType: 5
videoUrl: ''
localeTitle: 找到字符串中最长的单词
---
## Description
2020-06-30 01:51:26 -07:00
<section id="description">返回所提供句子中最长单词的长度。您的回答应该是一个数字。如果卡住,请记得使用<a href="https://forum.freecodecamp.org/t/how-to-get-help-when-you-are-stuck-coding/19514" target="_blank">Read-Search-Ask</a> 。编写自己的代码。 </section>
## Instructions
<section id="instructions">
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>findLongestWordLength(&quot;The quick brown fox jumped over the lazy dog&quot;)</code>应该返回一个数字。
testString: assert(typeof findLongestWordLength("The quick brown fox jumped over the lazy dog") === "number");
- text: <code>findLongestWordLength(&quot;The quick brown fox jumped over the lazy dog&quot;)</code>应该返回6。
testString: assert(findLongestWordLength("The quick brown fox jumped over the lazy dog") === 6);
- text: <code>findLongestWordLength(&quot;May the force be with you&quot;)</code>应该返回5。
testString: assert(findLongestWordLength("May the force be with you") === 5);
- text: <code>findLongestWordLength(&quot;Google do a barrel roll&quot;)</code>应返回6。
testString: assert(findLongestWordLength("Google do a barrel roll") === 6);
- text: <code>findLongestWordLength(&quot;What is the average airspeed velocity of an unladen swallow&quot;)</code>应该返回8。
testString: assert(findLongestWordLength("What is the average airspeed velocity of an unladen swallow") === 8);
- text: <code>findLongestWordLength(&quot;What if we try a super-long word such as otorhinolaryngology&quot;)</code>应该返回19。
testString: assert(findLongestWordLength("What if we try a super-long word such as otorhinolaryngology") === 19);
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function findLongestWordLength(str) {
return str.length;
}
findLongestWordLength("The quick brown fox jumped over the lazy dog");
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>