--- title: I before E except after C id: 5a23c84252665b21eecc7eb0 challengeType: 5 forumTopicId: 302288 --- ## Description
The phrase "I before E, except after C" is a widely known mnemonic which is supposed to help when spelling English words. Using the words provided, check if the two sub-clauses of the phrase are plausible individually:
  1. "I before E when not preceded by C".
  2. "E before I when preceded by C".
If both sub-phrases are plausible then the original phrase can be said to be plausible.
## Instructions
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.
## Tests
```yml tests: - text: IBeforeExceptC should be a function. testString: assert(typeof IBeforeExceptC=='function'); - text: IBeforeExceptC("receive") should return a boolean. testString: assert(typeof IBeforeExceptC("receive")=='boolean'); - text: IBeforeExceptC("receive") should return true. testString: assert.equal(IBeforeExceptC("receive"),true); - text: IBeforeExceptC("science") should return false. testString: assert.equal(IBeforeExceptC("science"),false); - text: IBeforeExceptC("imperceivable") should return true. testString: assert.equal(IBeforeExceptC("imperceivable"),true); - text: IBeforeExceptC("inconceivable") should return true. testString: assert.equal(IBeforeExceptC("inconceivable"),true); - text: IBeforeExceptC("insufficient") should return false. testString: assert.equal(IBeforeExceptC("insufficient"),false); - text: IBeforeExceptC("omniscient") should return false. testString: assert.equal(IBeforeExceptC("omniscient"),false); ```
## Challenge Seed
```js function IBeforeExceptC(word) { } ```
## Solution
```js function IBeforeExceptC(word) { if(word.indexOf("c")==-1 && word.indexOf("ie")!=-1) return true; else if(word.indexOf("cei")!=-1) return true; return false; } ```