2.5 KiB
id | title | challengeType | forumTopicId | dashedName |
---|---|---|---|---|
5a23c84252665b21eecc7eb0 | I before E except after C | 1 | 302288 | i-before-e-except-after-c |
--description--
"I before E, except after C" is a general rule for English language 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
.
与えられた単語を使用して、フレーズの2つの従属節がそれぞれ妥当かどうかを確認します。
- 「I before E when not before preceded by C」
- 「E before I when preceded by C」
両方の従属節が妥当である場合は、元のフレーズは妥当であると言うことができます。
--instructions--
単語を受け取り、その単語がルールに従っているかを確認する関数を記述してください。 この関数は、単語がルールに従っていれば true を、そうでない場合は false を返します。
--hints--
IBeforeExceptC
は関数とします。
assert(typeof IBeforeExceptC == 'function');
IBeforeExceptC("receive")
はブール値を返す必要があります。
assert(typeof IBeforeExceptC('receive') == 'boolean');
IBeforeExceptC("receive")
はtrue
を返す必要があります。
assert.equal(IBeforeExceptC('receive'), true);
IBeforeExceptC("science")
はfalse
を返す必要があります。
assert.equal(IBeforeExceptC('science'), false);
IBeforeExceptC("imperceivable")
は true
を返す必要があります。
assert.equal(IBeforeExceptC('imperceivable'), true);
IBeforeExceptC("inconceivable")
はtrue
を返す必要があります。
assert.equal(IBeforeExceptC('inconceivable'), true);
IBeforeExceptC("insufficient")
はfalse
を返す必要があります。
assert.equal(IBeforeExceptC('insufficient'), false);
IBeforeExceptC("omniscient")
はfalse
を返す必要があります。
assert.equal(IBeforeExceptC('omniscient'), false);
--seed--
--seed-contents--
function IBeforeExceptC(word) {
}
--solutions--
function IBeforeExceptC(word)
{
if(word.indexOf("c")==-1 && word.indexOf("ie")!=-1)
return true;
else if(word.indexOf("cei")!=-1)
return true;
return false;
}