scrimba
Note at 0:37
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

Note at 0:37
AboutCommentsNotes
Note at 0:37
Expand for more info
main.js
run
preview
console
const allLongestStrings = array =>
array.filter((v, i, a) =>
v.length === a.map(w => w.length).reduce((acc, cur) => cur > acc ? cur : acc, -1)
);

/**
* Test Suite
*/
describe('allLongestStrings()', () => {
it('returns all longest strings', () => {
// arrange
const strings = ["aba", "aa", "ad", "vcd", "aba", "a"];

// act
const result = allLongestStrings(strings);

// log
console.log("result: ", result);

// assert
expect(result).toEqual(["aba", "vcd", "aba"]);
});
});
Console
"result: "
,
[
"aba"
,
"vcd"
,
"aba"
]
,
/index.html
LIVE