Is Unique

[Solved] Is Unique | Perl - Code Explorer | yomemimo.com
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

Answers related to is unique

Code Explorer Popular Question For Perl