HASH: Adam is a genius

by Sue

This is code that makes total sense.

function search(type){
searchType = {
ITEMS: function(){
console.log('searchforItems');
},
BACKGROUNDS: function(){
console.log('searchforbackgrounds');
},
PROPS: function(){
console.log('searchforprops');
},
THEMES: function(){
console.log('searchforthemes');
}
}
searchType[type]();
}
search('ITEMS');

This might be duuuh for most, but was doing everything as private functions and the type was getting lost in scope so nothing happened. It was super annoying. Adam saved the day.