--- title: Evaluate binomial coefficients id: 598de241872ef8353c58a7a2 challengeType: 5 videoUrl: '' localeTitle: 评估二项式系数 --- ## Description

写一个函数来计算给定n和k值的二项式系数。

推荐这个公式:

$ \ binom {n} {k} = \ frac {n!} {(nk)!k!} = \ frac {n(n-1)(n-2)\ ldots(n-k + 1)} { k(k-1)(k-2)\ ldots 1} $
## Instructions
## Tests
```yml tests: - text: binom是一个功能。 testString: 'assert(typeof binom === "function", "binom is a function.");' - text: 'binom(5,3)应该返回10。' testString: 'assert.equal(binom(5, 3), 10, "binom(5,3) should return 10.");' - text: 'binom(7,2)应该返回21。' testString: 'assert.equal(binom(7, 2), 21, "binom(7,2) should return 21.");' - text: 'binom(10,4)应该返回210。' testString: 'assert.equal(binom(10, 4), 210, "binom(10,4) should return 210.");' - text: 'binom(6,1)应该返回6。' testString: 'assert.equal(binom(6, 1), 6, "binom(6,1) should return 6.");' - text: 'binom(12,8)应该返回495。' testString: 'assert.equal(binom(12, 8), 495, "binom(12,8) should return 495.");' ```
## Challenge Seed
```js function binom (n, k) { // Good luck! } ```
## Solution
```js // solution required ```