The <ahref="https://en.wikipedia.org/wiki/International_Bank_Account_Number">International Bank Account Number (IBAN)</a> is an internationally agreed means of identifying bank accounts across national borders with a reduced risk of propagating <ahref="https://en.wikipedia.org/wiki/Transcription_error">transcription errors</a>.
The IBAN consists of up to 34 alphanumeric characters:
<ul>
<li>first the two-letter ISO 3166-1 alpha-2 country code</li>
<li>then two check digits, and</li>
<li>finally a country-specific Basic Bank Account Number (BBAN).</li>
</ul>
The check digits enable a sanity check of the bank account number to confirm its integrity even before submitting a transaction.
Write a function that takes IBAN string as parameter. If it is valid return true. Otherwise, return false.
testString: assert(typeof isValid=='function','<code>isValid</code> should be a function.');
- text: <code>isValid("GB82 WEST 1234 5698 7654 32")</code> should return a boolean.
testString: assert(typeof isValid('GB82 WEST 1234 5698 7654 32')=='boolean','<code>isValid("GB82 WEST 1234 5698 7654 32")</code> should return a boolean.');
- text: <code>isValid("GB82 WEST 1234 5698 7654 32")</code> should return <code>true</code>.
testString: assert.equal(isValid('GB82 WEST 1234 5698 7654 32'),true,'<code>isValid("GB82 WEST 1234 5698 7654 32")</code> should return <code>true</code>.');
- text: <code>isValid("GB82 WEST 1.34 5698 7654 32")</code> should return <code>false</code>.
testString: assert.equal(isValid('GB82 WEST 1.34 5698 7654 32'),false,'<code>isValid("GB82 WEST 1.34 5698 7654 32")</code> should return <code>false</code>.');
- text: <code>isValid("GB82 WEST 1234 5698 7654 325")</code> should return <code>false</code>.
testString: assert.equal(isValid('GB82 WEST 1234 5698 7654 325'),false,'<code>isValid("GB82 WEST 1234 5698 7654 325")</code> should return <code>false</code>.');
- text: <code>isValid("GB82 TEST 1234 5698 7654 32")</code> should return <code>false</code>.
testString: assert.equal(isValid('GB82 TEST 1234 5698 7654 32'),false,'<code>isValid("GB82 TEST 1234 5698 7654 32")</code> should return <code>false</code>.');