Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

first non repeating character javascript

function firstNotRepeatingCharacter(s) {
    for (let i = 0; i < s.length; i++) {
        if(s.indexOf(s.charAt(i)) == s.lastIndexOf(s.charAt(i))) {
            return s.charAt(i)
        }
    }
    return '_'    
}
 
PREVIOUS NEXT
Tagged: #repeating #character #javascript
ADD COMMENT
Topic
Name
5+6 =