here is a code from a book.
<html>
<body>
<script type="text/javascript">
/* Paramater-Passing Basics
A function's basic syntax:
function functionname(pa rameter-list)
{
statements
}
*/
function message(name)
{
if (name != "")
alert("Hello there "+name);
else
alert("Don't be shy");
}
message("Jason" );
message();
</script>
</body>
</html>
basically, the empty function --> message(); is supposed to prompt the alert message "Don't be shy". Instead, it says hello there undefined.
based on the book, it says that calling the function either message(""); or without the paramater, message(); should prompt this message. it works only for message(""); and not without the parameter. ... whats goin on here??
<html>
<body>
<script type="text/javascript">
/* Paramater-Passing Basics
A function's basic syntax:
function functionname(pa rameter-list)
{
statements
}
*/
function message(name)
{
if (name != "")
alert("Hello there "+name);
else
alert("Don't be shy");
}
message("Jason" );
message();
</script>
</body>
</html>
basically, the empty function --> message(); is supposed to prompt the alert message "Don't be shy". Instead, it says hello there undefined.
based on the book, it says that calling the function either message(""); or without the paramater, message(); should prompt this message. it works only for message(""); and not without the parameter. ... whats goin on here??
Comment