As I said, it's great. The only thing I can add to your solution is that it's perhaps better to localize your colors
.
function write(what) {
var colors = [];
colors['Blue'] = function() { alert('Blue'); };
colors['Red'] = function() { alert('Red'); };
colors[what]();
}