It's saying that, for each letter i in the entered text, to the letter i + 2, if they are equal to " ", then they are two spaces.
In other words, it is checking each of the two letter combinations in the text to see if they match two spaces
For example:
"En", "nt", "te", "er", "r ", " s", "so", "om" etc...
So, slice is 'slicing' letters in the range specified in the parameters: str.slice(beginIndex[, endIndex])
Edit: Didn't see the prompt() call, so updated accordingly.
Perhaps try this in order to get a better idea of what's happening:
var str = prompt("Enter some text");
var numChars = str.length;
for (var i = 0; i < numChars; i++) {
if (str.slice(i, i + 2) === " ") {
alert("No double spaces!");
break;
} else {
document.write(str.slice(i, i + 2) + "<br>")
}
}
ifit should probably be" "(two spaces).