This is a really dumb question, but please help me understand this line of code
if (freq[char]). What does it mean? How variable can be in an array without the push() method?
function removeDupl(arg) {
var answer = "";
var freq = [];
for (i = 0; i < arg.length; i++) {
let char = arg[i]
if (freq[char]) { <------- What does it mean ? what condition is that?
freq[char]++
console.log("Duplicate:"+ char)
} else {
freq[char] = 1
answer = answer + char
console.log("not a duplicate:"+char)
}
}
return answer;
}