scrimba
Note at 3:29
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 3:29
AboutCommentsNotes
Note at 3:29
Expand for more info
main.js
run
preview
console
const charRegex = /[a-z]/i

function differentSymbolsNaive(str) {
if (!str || typeof str !== 'string') {
return 0
}

return new Set(str.split('').filter(c => charRegex.test(c))).size;
}



/**
* Test Suite
*/
describe('differentSymbolsNaive()', () => {
it('returns count of unique characters', () => {
// arrange
const str = 'cabca';

// act
const result = differentSymbolsNaive(str);

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

// assert
expect(result).toBe(3);
});
});
Console
"result: "
,
3
,
/index.html
LIVE