Skip to content

Instantly share code, notes, and snippets.

@JeanSebTr
Created March 9, 2012 00:24
Show Gist options
  • Save JeanSebTr/2004316 to your computer and use it in GitHub Desktop.
Save JeanSebTr/2004316 to your computer and use it in GitHub Desktop.
Défi du opencode #3
function methode(txt) {
var res = {};
for(var i=0;i<txt.length;i++) {
res[txt[i]] = (res[txt[i]] || 0) + 1;
}
return res;
}
var txt = 'ahsgdasdfjsa';
console.log('Analyse de :', txt, ':', methode(txt));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment