Function prototype: Difference between revisions
Content added Content deleted
Line 312: | Line 312: | ||
=={{header|JavaScript}}== |
=={{header|JavaScript}}== |
||
=== ES5 === |
|||
JavaScript functions may also be used to define prototype objects |
|||
<lang JavaScript> |
<lang JavaScript> |
||
// A prototype declaration for a function that does not require arguments |
// A prototype declaration for a function that does not require arguments |
||
Line 331: | Line 332: | ||
l.pop(); // 5 |
l.pop(); // 5 |
||
l.length; // 0 |
l.length; // 0 |
||
// A prototype declaration for a function that utilizes varargs |
// A prototype declaration for a function that utilizes varargs |
||
Line 355: | Line 354: | ||
</lang> |
</lang> |
||
=== ES6 === |
|||
Class Declarations are used to define prototype objects |
|||
<lang JavaScript> |
<lang JavaScript> |
||
// A prototype declaration for a function that does not require arguments |
// A prototype declaration for a function that does not require arguments |