var arr = [];
repeatcount = 0;
function isogram(str) {
for (var i = 0; i < str.length; i++) {
for (var g = 0; g < arr.length; g++) {
if (str[i] != arr[g]) {
arr.push(str[i]);
}
}
}
if (arr.length != str.length) {
return false
} else {
return true
}
}
document.write(isogram("jiang"));
console.log(arr);
When I am using console.log(arr), I found that the arr is empty, and I don't know why. The approach I am using is basically creating an array that stores non-repeating character then compare the length, if the length is different then there is repeating character.