Created
October 16, 2014 17:15
-
-
Save federicobucchi/260e4de3d3bc2a96abdf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function firstNotRepeatedChar(str) { | |
var arr = str.split(''); | |
var result = ''; | |
var count = 0; | |
for (var i = 0; i < arr.length; i++) { | |
count = 0; | |
for (var y = 0; y < arr.length; y++) { | |
if (arr[i] == arr[y]) { | |
count +=1; | |
} | |
} | |
if (count < 2) { | |
result = arr[i]; | |
break; | |
} | |
} | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment