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 :: node get unix timestamp 
Javascript :: angular generate component 
Javascript :: how to update version of dependencies reactjs 
Javascript :: appTsConfig.compilerOptions[option] = value; 
Javascript :: how to use Node.js Client for Google Maps Services for geolocation 
Javascript :: como saber la resolucion de una ventana con javascript 
Javascript :: nodejs release variable 
Javascript :: how to check if you click something in javascript 
Javascript :: scroll to bottom of an element 
Javascript :: loopback user password setter overwrite 
Javascript :: object loop in javascript 
Javascript :: node.js http request ip address 
Javascript :: javascript onclick display none 
Javascript :: detect chrome version javascript 
Javascript :: array traversal backward 
Javascript :: get previous url javascript 
Javascript :: node:internal/crypto/hash:67 this[kHandle] = new _Hash(algorithm, xofLen); 
Javascript :: jquery if attribute 
Javascript :: js push params to url 
Javascript :: Read only directories in node 
Javascript :: most 5 spoken language in countries array in js 
Javascript :: ng generate component in folder 
Javascript :: Sort numbers from an array in javascript 
Javascript :: javascript convert to two decimal places 
Javascript :: javascript unicode decoder 
Javascript :: how to get data from user in javascript 
Javascript :: javascript read xlsx file 
Javascript :: get window resolution javascript 
Javascript :: stateprovider.js react 
Javascript :: laravel ajax delete 
ADD CONTENT
Topic
Content
Source link
Name
5+9 =