2018-10-04 13:37:37 +00:00
---
id: 5a23c84252665b21eecc7eb0
2020-11-27 18:02:05 +00:00
title: I before E except after C
2018-10-04 13:37:37 +00:00
challengeType: 5
2019-08-05 16:17:33 +00:00
forumTopicId: 302288
2021-01-13 02:31:00 +00:00
dashedName: i-before-e-except-after-c
2018-10-04 13:37:37 +00:00
---
2020-11-27 18:02:05 +00:00
# --description--
2022-05-30 08:06:24 +00:00
**"I before E, except after C"** is a mnemonic rule of thumb for English spelling. If one is unsure whether a word is spelled with the digraph `ei` or `ie` , the rhyme suggests that the correct order is `ie` unless the preceding letter is `c` , in which case it may be `ei` .
2020-11-27 18:02:05 +00:00
2018-10-04 13:37:37 +00:00
Using the words provided, check if the two sub-clauses of the phrase are plausible individually:
2020-11-27 18:02:05 +00:00
2019-03-06 05:18:18 +00:00
< ol >
< li >
< i > "I before E when not preceded by C".< / i >
< / li >
< li >
< i > "E before I when preceded by C".< / i >
< / li >
< / ol >
2020-11-27 18:02:05 +00:00
2018-10-04 13:37:37 +00:00
If both sub-phrases are plausible then the original phrase can be said to be plausible.
2020-11-27 18:02:05 +00:00
# --instructions--
2019-03-06 05:18:18 +00:00
Write a function that accepts a word and check if the word follows this rule. The function should return true if the word follows the rule and false if it does not.
2018-10-04 13:37:37 +00:00
2020-11-27 18:02:05 +00:00
# --hints--
`IBeforeExceptC` should be a function.
```js
assert(typeof IBeforeExceptC == 'function');
2018-10-04 13:37:37 +00:00
```
2020-11-27 18:02:05 +00:00
`IBeforeExceptC("receive")` should return a boolean.
2018-10-04 13:37:37 +00:00
2020-11-27 18:02:05 +00:00
```js
assert(typeof IBeforeExceptC('receive') == 'boolean');
```
2018-10-04 13:37:37 +00:00
2020-11-27 18:02:05 +00:00
`IBeforeExceptC("receive")` should return `true` .
2018-10-04 13:37:37 +00:00
```js
2020-11-27 18:02:05 +00:00
assert.equal(IBeforeExceptC('receive'), true);
```
2020-09-15 16:57:40 +00:00
2020-11-27 18:02:05 +00:00
`IBeforeExceptC("science")` should return `false` .
```js
assert.equal(IBeforeExceptC('science'), false);
```
`IBeforeExceptC("imperceivable")` should return `true` .
```js
assert.equal(IBeforeExceptC('imperceivable'), true);
```
`IBeforeExceptC("inconceivable")` should return `true` .
```js
assert.equal(IBeforeExceptC('inconceivable'), true);
2018-10-04 13:37:37 +00:00
```
2020-11-27 18:02:05 +00:00
`IBeforeExceptC("insufficient")` should return `false` .
2018-10-04 13:37:37 +00:00
2020-11-27 18:02:05 +00:00
```js
assert.equal(IBeforeExceptC('insufficient'), false);
```
2018-10-04 13:37:37 +00:00
2020-11-27 18:02:05 +00:00
`IBeforeExceptC("omniscient")` should return `false` .
2018-10-04 13:37:37 +00:00
2020-11-27 18:02:05 +00:00
```js
assert.equal(IBeforeExceptC('omniscient'), false);
```
2018-10-04 13:37:37 +00:00
2020-11-27 18:02:05 +00:00
# --seed--
2018-10-04 13:37:37 +00:00
2020-11-27 18:02:05 +00:00
## --seed-contents--
```js
function IBeforeExceptC(word) {
}
```
# --solutions--
2018-10-04 13:37:37 +00:00
```js
2019-03-06 05:18:18 +00:00
function IBeforeExceptC(word)
2018-10-04 13:37:37 +00:00
{
2020-11-27 18:02:05 +00:00
if(word.indexOf("c")==-1 & & word.indexOf("ie")!=-1)
return true;
else if(word.indexOf("cei")!=-1)
return true;
return false;
2018-10-04 13:37:37 +00:00
}
```