Welcome visitors of MIC Computer

Welcome to my blog. With this blog you can post your question about computer and programming for absolutely free (free consultation sponsored by MIC Computer).. Well what are you waiting for just feel free to post your question or share with me about your computer / programming experience

Wednesday, October 26, 2011

Javascript Procedure and Function

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: