scrimba
Note at 0:04
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:04
AboutCommentsNotes
Note at 0:04
Expand for more info
main.js
run
preview
console
function differentSymbolsNaive(str) {
// write code here.
let splitStr = str.split(''); //splits string for individual values
let strArr = []; //creates new array, that will only hold all unique characters
for (let i = 0; i < str.length; i++) {
if (strArr.includes(splitStr[i])) {

} else {
strArr.push(splitStr[i]);
}
}
return strArr.length;
}



/**
* 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