function isUnique(s = '') { for (let i = 0; i < s.length; i++) { const c = s[i] const index = s.indexOf(c) if (index !== i) { return false } } return true } console.log(isUnique('abdfgf'))