Skip to content
Akin C edited this page Apr 15, 2018 · 7 revisions

Welcome to the Javascript-function-method-constructor-call- wiki!

This repository is part of a larger project!

◀️ PREVIOUS PROJECT| NEXT PROJECT ▶️


Functions, methods and constructors are in Javascript different variations of one common thing and that is function. These three function patterns can be called in a visible distinct way:


  1. Function call - example


function simpleFunction()
{
    alert("Hello world");
}

//Call
simpleFunction();

  1. Method call - example


var simpleObject = 
{
   method: function()
   {
       alert("Hello world");
   }
}

//Call
simpleObject.method();

  1. Constructor call - example


function simpleConstructor(anyArgument) 
{
   this.attribute = anyArgument;
}

//Using the 'new' operator treats it as a constructor
var anyObject = new simpleConstructor("Hello world");

//Call
simpleObject.attribute();

Content

The user interaction part should look like the content as seen below by starting "index.html" in a web browser.

ERROR: No image found!

The colored areas are just for a better readability in the wiki and are not part of the content. To use the project just download the files and execute "index.html". Note that all files should be placed in the same folder so that the functionality of the code is guaranteed.