Hi there,
I am working at the moment on the intermediate JS challenges ( “JavaScript Practice: Arrays, Loops, Objects, Iterators”, task 2). I found a piece of code I know now, how to use, but I don’t really understand. Hopefully, someone can explain what exactly the code does, or why! it works.
const string = ‘summer’
var count = string.split(char).length - 1;
console.log(count);
//logs: 2
Many thanks upfront!