As an programming language that support OOP, Javascript also have procedure and function. Procedure and function on javascript has the same format like PHP and any other C++ style language.
function procedure_and_function_name(var1,var2,...,varX)
{
javascript code
}
As you can see procedure and function format has the same format. The different is function has a statement like this:
Return(variable_or_value);here is some example:
Example of procedure:
function message(message_contain)
{
alert("This is my message "+message_contain);
}
Example of function:
function message(message_contain)
{
return("This is my message "+message);
}
echo(message("Hello friend"));
Hope this can help you
No comments:
Post a Comment