Understanding that functions are objects in JavaScript