scrimba
Note at 0:01
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:01
by Hil
AboutCommentsNotes
Note at 0:01
by Hil
Expand for more info
main.js
run
preview
console
function differentSymbolsNaive(str) {
// write code here.
//includes split push

let newString = str.split("");
let newArray = [];

for (let i = 0; i < newString.length; i++) {
if (newString.includes(newString[i])
&& !newArray.includes(newString[i])) {
newArray.push(newString[i])
}
}
return newArray.length;
}



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

// act
const result = differentSymbolsNaive(str);

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

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