In all programming languages the use of methods is essential for the development of activities, with them you can reuse blocks of code throughout the project so that it is much easier to process or have return of certain information.

In Javascript, methods are called functions and are created using syntax function().


This type of function is declared to perform a given code block. Finished processing, the code continues to run again within the logic implemented.

<SCRIPT LANGUAGE=”javaScript” type=”text/javaScript”>
function hello() {
document.write (“Welcome.”);


This type of function returns a value from the source code implemented. This value is often used in another process, to return the information to return syntax is used, check out the example below:

<SCRIPT LANGUAGE=”JavaScript” TYPE=”text/javascript”>
function sum() {
return 10+5;

document.write (“10 + 5 = ” + soma() );


These functions are used when you need to process certain information from a variable informed by the developer.

<SCRIPT LANGUAGE=”JavaScript” TYPE=”text/javascript”>
function mostrar (msg){
document.write (msg);

function sum(x, y){
return x+y;

var resultado;
mostrar (” 20 + 30 =“);
result = sum(20, 30);


All formats functions are used in everyday life of a programmer at all is because of this pattern that we can work any kind of logic programming.

Want to test our examples and learn more about one of the tools of development the fastest growing market? Then download the free version already Scriptcase and start today to enjoy all the benefits of our tool.


SCRIPTCASE: What is VS What is not

What is VS What is not What is ScriptCase? It is a fast development environment with tools that f...



We will use the information you provide to update you about our Newsletter and Special Offers. You can unsubscribe any time you want by clinck in a link in the footer of any email you receive from us, or by contacting us at Learn more about our Privacy Police.