scrimba
Note at 0:09
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:09
AboutCommentsNotes
Note at 0:09
Expand for more info
main.js
run
preview
console
function differentSymbolsNaive(str) {
console.log(str.split(''));
var temp=[];
temp.push(str[0]);
for(let i=1; i<str.length; i++)
if(!temp.includes(str[i]))
temp.push(str[i]);

console.log(temp.length);
return temp.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
[
"c"
,
"a"
,
"b"
,
"c"
,
"a"
]
,
3
,
"result: "
,
3
,
/index.html
LIVE