<title> Greeting </title>
alert ("Hello, "+ who + '' + who2);
var who = prompt ("what is your first name");
var who2 = prompt ("what is your last name");
alert("Hello " + who + ' ' + who2);
It does not do the same thing.
You NEVER call the function, so it does nothing!
Functions are good for helping you reuse code blocks that do specific tasks without having to write the code again and again, you just call a function and the interpreter then fetches that code block, runs it and the output is then generated if any output is needed, etc.
Functions are your friend
Please remember to wrap any code you have in forum tags:-
[CODE]...[/CODE] [HTML]...[/HTML] [PHP]...[/PHP]
If you can't think outside the box, you will be trapped forever with no escape...
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)