Actually that's less efficient (but neater, admittedly). for..in loops are very slow. Neater still, no guarantee of efficiency (but got to be better than the for..in):
Code:
var say = (function(words, v, say) {
return say = function(sentence) {
(v = words[(alert(sentence), sentence).toLowerCase()]) && say(v);
};
})({
"s---" : "How dare you use such language!",
"f---" : 'You could just say "Whoops!"',
"ma'am, you dropped that anvil on your toe." : "S---",
"did you remember to mail the gas bill?" : "F---"
});
Aren't you from America, Magicyte? Your English seems somewhat non-native...
Bookmarks