Hello
I am new to Javascript and trying to write this script that prompts a user for first and last name and then greets them. I have tried this and I am not sure if it is the best way to do it. It seems to work but it does not space the name. Any help would be appreciated. Thanks!
<html>
<head>
<title>Home Page</title>
<script type="text/javascript">
var who1=prompt("What is your first name?");
var who2=prompt("What is your last name?");
function greeting(who1,who2){
answer = who1+who2;
return answer;
}
</script>
</head>
<body>
<script type="text/javascript">
document.write("Welcome to my site " +greeting(who1,who2));
</script>
</body>
</html>