Skip to content

Instantly share code, notes, and snippets.

@Constellation
Created November 10, 2009 06:04
Show Gist options
  • Select an option

  • Save Constellation/230661 to your computer and use it in GitHub Desktop.

Select an option

Save Constellation/230661 to your computer and use it in GitHub Desktop.
var count = function(str){
str = str.split("");
var memo = {};
var c = 0;
for(var i = 0, len = str.length; i < len; ++i){
if(!/\s/.test(str[i]) && !(str[i] in memo)){
memo[str[i]] = true;
++c;
}
}
return c;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment