While looking through an old codebase of ours, I came upon this little snippet:
var getElementByXpath = function (path) {
return document.evaluate(path, document, null, 9, null).singleNodeValue;
};
Why did they declare a variable and assign an anonymous function to it, rather than simply create a named function? How is that any different from the (much more normal and common) following?
function getElementByXpath(path) {
return document.evaluate(path, document, null, 9, null).singleNodeValue;
};