Function.prototype : Function Object « Function « JavaScript Tutorial






Syntax

function.prototype.property
    function.prototype.method

The prototype property refers to the object that serves as the prototype from which classes are created.

prototype allows you to add new properties of methods to an existing class by adding them to the prototype associated with the constructor of that class.

<html>
    <body>
    <script lanuguage="JavaScript">
    <!--
    var mytask = new String();

    function setTask(str){
        var task="task a";
        if(str != null){
         task = str;
        }
        return task;
    }
    String.prototype.duty = setTask;
    document.write("The first task is: " + mytask.duty("Nothing") + "<br>");
    document.write("The next task is: " + mytask.duty());
    -->
    </script>
    </body>
    </html>








7.2.Function Object
7.2.1.Function() (capital F)
7.2.2.Function.apply()
7.2.3.Function.arguments
7.2.4.Function.arity
7.2.5.Function.call()
7.2.6.Function.caller
7.2.7.Function.prototype
7.2.8.Function.toSource()
7.2.9.Function.toString()