2018-10-10 22:03:03 +00:00
---
id: 5a23c84252665b21eecc7eb0
2021-02-06 04:42:36 +00:00
title: I before E except after C
2018-10-10 22:03:03 +00:00
challengeType: 5
2021-02-06 04:42:36 +00:00
forumTopicId: 302288
2021-01-13 02:31:00 +00:00
dashedName: i-before-e-except-after-c
2018-10-10 22:03:03 +00:00
---
2020-12-16 07:37:30 +00:00
# --description--
2021-02-06 04:42:36 +00:00
The phrase ["I before E, except after C" ](https://en.wikipedia.org/wiki/I before E except after C ) is a widely known mnemonic which is supposed to help when spelling English words.
2020-12-16 07:37:30 +00:00
2021-02-06 04:42:36 +00:00
Using the words provided, check if the two sub-clauses of the phrase are plausible individually:
2020-12-16 07:37:30 +00:00
2021-02-06 04:42:36 +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 >
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.
2020-12-16 07:37:30 +00:00
# --hints--
2021-02-06 04:42:36 +00:00
`IBeforeExceptC` should be a function.
2020-12-16 07:37:30 +00:00
```js
assert(typeof IBeforeExceptC == 'function');
```
2021-02-06 04:42:36 +00:00
`IBeforeExceptC("receive")` should return a boolean.
2018-10-10 22:03:03 +00:00
2020-12-16 07:37:30 +00:00
```js
assert(typeof IBeforeExceptC('receive') == 'boolean');
2018-10-10 22:03:03 +00:00
```
2021-02-06 04:42:36 +00:00
`IBeforeExceptC("receive")` should return `true` .
2018-10-10 22:03:03 +00:00
2020-12-16 07:37:30 +00:00
```js
assert.equal(IBeforeExceptC('receive'), true);
```
2018-10-10 22:03:03 +00:00
2021-02-06 04:42:36 +00:00
`IBeforeExceptC("science")` should return `false` .
2018-10-10 22:03:03 +00:00
```js
2020-12-16 07:37:30 +00:00
assert.equal(IBeforeExceptC('science'), false);
```
2021-02-06 04:42:36 +00:00
`IBeforeExceptC("imperceivable")` should return `true` .
2018-10-10 22:03:03 +00:00
2020-12-16 07:37:30 +00:00
```js
assert.equal(IBeforeExceptC('imperceivable'), true);
2018-10-10 22:03:03 +00:00
```
2021-02-06 04:42:36 +00:00
`IBeforeExceptC("inconceivable")` should return `true` .
2018-10-10 22:03:03 +00:00
2020-12-16 07:37:30 +00:00
```js
assert.equal(IBeforeExceptC('inconceivable'), true);
```
2018-10-10 22:03:03 +00:00
2021-02-06 04:42:36 +00:00
`IBeforeExceptC("insufficient")` should return `false` .
2018-10-10 22:03:03 +00:00
2020-12-16 07:37:30 +00:00
```js
assert.equal(IBeforeExceptC('insufficient'), false);
```
2018-10-10 22:03:03 +00:00
2021-02-06 04:42:36 +00:00
`IBeforeExceptC("omniscient")` should return `false` .
2018-10-10 22:03:03 +00:00
```js
2020-12-16 07:37:30 +00:00
assert.equal(IBeforeExceptC('omniscient'), false);
2018-10-10 22:03:03 +00:00
```
2020-08-13 15:24:35 +00:00
2021-01-13 02:31:00 +00:00
# --seed--
## --seed-contents--
```js
function IBeforeExceptC(word) {
}
```
2020-12-16 07:37:30 +00:00
# --solutions--
2021-01-13 02:31:00 +00:00
```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;
}
```