Entropy

Feb. 2, 2013, 12:32 p.m.
var message = "ananas";
var hash = new Array();
for (var i = 0; i < message.length; i++) {
    var char = message.charAt(i);
    if (typeof(hash[char]) == 'undefined')
        hash[char] = 1;
    else
        hash[char]++;
}
for (var key in hash) {
    WSH.Echo(key + " : " + hash[key]);
}
comments powered by Disqus