Search
 
SCRIPT & CODE EXAMPLE
 

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 '_'    
}
Comment

first repeated character in a string javascript

function firstRepeatingCharacter(str) {
  for (let i = 0; i < str.length; i++) {
    if (str.indexOf(str.charAt(i)) !== str.lastIndexOf(str.charAt(i))) {
      return str.charAt(i)
    }
  }
  return 'no results found'
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: js find index in list 
Javascript :: get first word in javascript 
Javascript :: javascript create array with null values 
Javascript :: how to get array from number length 
Javascript :: nodejs sha512 decrypt 
Javascript :: process.stdin.on("data", function (input) { _input += input; }); 
Javascript :: binary gap 
Javascript :: handlerbar console log 
Javascript :: how to hide title bar react-navigation 
Javascript :: bootstrap datepicker options 
Javascript :: get last word in string js 
Javascript :: toggle boolean js 
Javascript :: react native navigation navigate 
Javascript :: get id of element javascript 
Javascript :: fix footer 
Javascript :: typescript class constructor overload 
Javascript :: mongodb sort objectid 
Javascript :: loading image in react js 
Javascript :: determine text truncate javascript 
Javascript :: react native apk bundle 
Javascript :: saving text in javascript 
Javascript :: ifsc code validation regex 
Javascript :: vuex state from another module 
Javascript :: covid-19 
Javascript :: ajax get 
Javascript :: How to fetch API data using POST and GET in PHP 
Javascript :: javascript get phone number from string 
Javascript :: hashing in node js 
Javascript :: timeout httppost angular 
Javascript :: random coordinates js 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =