Skip to content

Instantly share code, notes, and snippets.

@elijahmanor
Created January 27, 2012 05:48
Skype-enabled JavaScript Restaurant
var restaurant = (function($) {
var pub = {},
menu = [ "(pi)", "(^)" ],
drinks = [ "(coffee)", "(beer)", "(d)" ];
pub.eat = function(call) {
if ( call === "(pi)" ) {
console.log( "(happy)" );
} else if ( call === "(^)" ) {
console.log( "(party)" );
} else if ( call === "(bug)" ) {
console.log( "(puke)" );
}
};
pub.drink = function(call) {
if ( call === "(beer)" || call === "(d)" ) {
console.log( "(drunk)" );
} else if ( call === "(coffee)" ) {
console.log( "(surprised)" );
}
};
pub.listen = function(music) {
console.log( "(dance)" );
};
return pub;
}(jQuery));
restaurant.listen();
restaurant.eat( "(pi)" );
restaurant.drink( "(beer)" );
restaurant.eat( "(bug)" );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment