Question : is Unique
Answered by : mohammad-alshraideh
function is_unique(str) { var obj = {}; for (var z = 0; z < str.length; ++z) { var ch = str[z]; if (obj[ch]) return false; obj[ch] = true; } return true;
}
console.log(is_unique("abcdefgh")); // true
console.log(is_unique("aa")); // false
Source : | Last Update : Tue, 06 Sep 22