Files
.github
api-server
client
config
curriculum
challenges
_meta
arabic
chinese
english
01-responsive-web-design
02-javascript-algorithms-and-data-structures
basic-algorithm-scripting
basic-data-structures
basic-javascript
debugging
es6
functional-programming
intermediate-algorithm-scripting
arguments-optional.english.md
binary-agents.english.md
convert-html-entities.english.md
diff-two-arrays.english.md
dna-pairing.english.md
drop-it.english.md
everything-be-true.english.md
make-a-person.english.md
map-the-debris.english.md
missing-letters.english.md
pig-latin.english.md
search-and-replace.english.md
seek-and-destroy.english.md
smallest-common-multiple.english.md
sorted-union.english.md
spinal-tap-case.english.md
steamroller.english.md
sum-all-numbers-in-a-range.english.md
sum-all-odd-fibonacci-numbers.english.md
sum-all-primes.english.md
wherefore-art-thou.english.md
javascript-algorithms-and-data-structures-projects
object-oriented-programming
regular-expressions
03-front-end-libraries
04-data-visualization
05-apis-and-microservices
06-quality-assurance
07-scientific-computing-with-python
08-data-analysis-with-python
09-information-security
10-coding-interview-prep
11-machine-learning-with-python
12-certificates
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
md-translation.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

78 lines
1.6 KiB
Markdown
Raw Normal View History

---
id: af7588ade1100bde429baf20
title: Missing letters
isRequired: true
challengeType: 5
isHidden: false
forumTopicId: 16023
---
## Description
<section id='description'>
Find the missing letter in the passed letter range and return it.
If all letters are present in the range, return undefined.
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>fearNotLetter("abce")</code> should return "d".
testString: assert.deepEqual(fearNotLetter('abce'), 'd');
- text: <code>fearNotLetter("abcdefghjklmno")</code> should return "i".
testString: assert.deepEqual(fearNotLetter('abcdefghjklmno'), 'i');
- text: <code>fearNotLetter("stvwx")</code> should return "u".
testString: assert.deepEqual(fearNotLetter('stvwx'), 'u');
- text: <code>fearNotLetter("bcdf")</code> should return "e".
testString: assert.deepEqual(fearNotLetter('bcdf'), 'e');
- text: <code>fearNotLetter("abcdefghijklmnopqrstuvwxyz")</code> should return undefined.
testString: assert.isUndefined(fearNotLetter('abcdefghijklmnopqrstuvwxyz'));
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function fearNotLetter(str) {
return str;
}
fearNotLetter("abce");
```
</div>
</section>
## Solution
<section id='solution'>
```js
function fearNotLetter (str) {
for (var i = str.charCodeAt(0); i <= str.charCodeAt(str.length - 1); i++) {
var letter = String.fromCharCode(i);
if (str.indexOf(letter) === -1) {
return letter;
}
}
return undefined;
}
```
</section>