У меня есть этот массив:
let a = ["a", "www", "qwqwq"];
, и мне нужно повторить его, чтобы получить ha sh каждого отдельного элемента. и сохраните его в одной переменной в виде строки.
function hashCode(str) {
var hash = 0;
if (str.length == 0) return hash;
for (i = 0; i < str.length; i++) {
char = str.charCodeAt(i);
hash = (hash << 5) - hash + char;
hash = hash & hash; // Convert to 32bit integer
}
return hash;
}
let strHash = "";
for (b of a){
strHash.concat(`${hashCode(b)}`)
}
console.log(strHash)
, но я получаю пустую строку. почему?