java script assignment - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

java script assignment

jaynesmyjaynesmy Posts: 5Member
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!




Home Page


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;
}






document.write("Welcome to my site " +greeting(who1,who2));




Comments

Sign In or Register to comment.