📅  最后修改于: 2022-03-11 14:56:10.039000             🧑  作者: Mango
// First non repeating character position in a string
function first_non_repeating_letter(str) {
for(var i = 0; i < str.length; i++) {
if (str.indexOf(str[i]) === str.lastIndexOf(str[i])) {
return i
}
}
return null
}
console.log("First non repeating character position = " +
first_non_repeating_letter("abcdcba")); //3