--- title: Top rank per group id: 595011cba5a81735713873bd challengeType: 5 videoUrl: '' localeTitle: '' --- ## Description undefined ## Instructions undefined ## Tests
```yml tests: - text: '' testString: 'assert(typeof topRankPerGroup === "function", "topRankPerGroup is a function.");' - text: '' testString: 'assert(typeof topRankPerGroup(-1, []) === "undefined", "topRankPerGroup returns undefined on negative n values.");' - text: '' testString: 'assert.equal(res1[0][0].dept, "D050", "First department must be D050");' - text: '' testString: 'assert.equal(res1[0][1].salary, 21900, "First department must be D050");' - text: '' testString: 'assert.equal(res1[3][3].dept, "D202", "The last department must be D202");' - text: '' testString: 'assert.equal(res2[2].length, 1, "topRankPerGroup(1, ...) must return only top ranking result per group.");' - text: '' testString: 'assert.equal(res3[2][1].name, "Maze Runner", "topRankPerGroup(1, ...) must return only top ranking result per group.");' ```
## Challenge Seed
```js function topRankPerGroup(n, data, groupName, rankName) { // Good luck! return true; } ```
### After Test
```js console.info('after the test'); ```
## Solution
```js // solution required ```