var firstUniqChar = function(s) { for( let i = 0; i < s.length; i++) { const letter = s[i] if(s.indexOf(letter) === s.lastIndexOf(letter)) { return i } } return -1 };