freeCodeCamp/curriculum/challenges/chinese/08-coding-interview-prep/rosetta-code/sedols.chinese.md

2.1 KiB
Raw Blame History

title id challengeType videoUrl localeTitle
SEDOLs 59d9c6bc214c613ba73ff012 5 SEDOLs

Description

任务:

对于6位SEDOL的每个数字列表,计算并附加校验和数字。

也就是说,给定左侧的输入字符串,您的函数应返回右侧的相应字符串:

 <pre> 710889 => 7108899 B0YBKJ => B0YBKJ7 406566 => 4065663 B0YBLH => B0YBLH2 228276 => 2282765 B0YBKL => B0YBKL9 557910 => 5579107 B0YBKR => B0YBKR5 585284 => 5852842 B0YBKT => B0YBKT7 B00030 => B000300 </pre> 

还要检查每个输入是否正确形成尤其是对于SEDOL字符串中允许的有效字符。您的函数应在无效输入时返回null

Instructions

Tests

tests:
  - text: <code>sedol</code>是一个功能。
    testString: 'assert(typeof sedol === "function", "<code>sedol</code> is a function.");'
  - text: '<code>sedol(&#39;a&#39;)</code>应该返回null。“'
    testString: 'assert(sedol("a") === null, "<code>sedol("a")</code> should return null.");'
  - text: '<code>sedol(&#39;710889&#39;)</code>应返回&#39;7108899&#39;。“)'
    testString: 'assert(sedol("710889") === "7108899", "<code>sedol("710889")</code> should return "7108899".");'
  - text: '<code>sedol(&#39;BOATER&#39;)</code>应该返回null。“'
    testString: 'assert(sedol("BOATER") === null, "<code>sedol("BOATER")</code> should return null.");'
  - text: '<code>sedol(&#39;228276&#39;)</code>应该返回&#39;2282765&#39;。“)'
    testString: 'assert(sedol("228276") === "2282765", "<code>sedol("228276")</code> should return "2282765".");'

Challenge Seed

function sedol (input) {
  // Good luck!
  return true;
}

Solution

// solution required