// assign a function to a variable var sayHello = function(){console.log("Hello!");}; sayHello(); // assign a function to an object var myObject = {firstName:"peter", lastName:"parker"}; myObject.sayHello = function(){console.log("Object function");}; myObject.sayHello(); // function takes function as an argument function myfunction(func){ func(); } myfunction(sayHello);