Revisions

gist: 230661 Download_button fork
public
Public Clone URL: git://gist.github.com/230661.git
Embed All Files: show embed
count.js #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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;
}