This is a very simple JavaScript code but I get this undefined error, I don't know what I'm doing wrong. The result I get from the following script is Great to see you, undefinedRaj. Can someone please explain what does the undefined refer to and how can I remove it.
var greeting = function (name) {
document.write("Great to see you," + " " + name);
};
document.write(greeting(name) + "Raj");