Skip to content

Instantly share code, notes, and snippets.

Last active Apr 7, 2016
What would you like to do?
// generic reportOrders that shows your orders to the function
function reportOrders (minionOrders) {
if ( typeof minionOrders === "string"){
else if ( typeof minionOrders === "object"){
for (var item in minionOrders) {
console.log(item + ": " + minionOrders[item]);
// A function that takes two parameters, the last one a callback function​
function speakOrders (orders, minion) {
// When we call the speakOrders function, we pass reportOrders as a parameter.​
// So reportOrders will be the function that will called back (or executed) inside the speakOrders function​
speakOrders ({name:"Minion1031", speciality:"Scribe"}, reportOrders);
// Console
// name: Minion1031
// speciality: Scribe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment