scrimba
Note at 2:45
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 2:45
AboutCommentsNotes
Note at 2:45
Expand for more info
main.js
run
preview
console

function differentSymbolsNaive(str) {
if (!str) return 0;
let currentNum = new Set();
const strArray = str.split('');
for (let i = 0; i < strArray.length; i++) {
currentNum.add(strArray[i]);
}
return currentNum.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