Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var status = {
'worker' : 0,
'student' : 1,
'fish' : 2
};
var time = {
'morning' : 0,
'evening' : 1,
'night' : 2
}
var text = [
['get ready for working!', 'work hard!', 'sleep well for tomorrow!'],
['sleep till noon...', 'have breakfast', 'play video games'],
['swim slowly', 'swim quickly', 'swim very slowly']
];
function whoDoesWhat_short(a, b) {
var who = status[a];
var what = time[b];
console.log(text[who][what]);
}
whoDoesWhat_short('worker', 'evening'); // work hard!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment