Microsoft® JScript prototype Property |
Language Reference Version 2 |
Contains a reference to the prototype for a class of objects.
objectname.prototypeThe objectname argument is the name of an object.
Use the prototype property to provide a base set of functionality to a class of objects. New instances of an object "inherit" the behavior of the prototype assigned to that object.For example, say you wanted to add a method to the Array object that returns the value of the largest element of the array. To do this, declare the function, add it to Array.prototype, and then use it.
After this code is executed, y contains the largest value in the array x, or 6.function array_max( ) { var i, max = this[0]; for (i = 1; i < this.length; i++) { if (max < this[i]) max = this[i]; } } Array.prototype.max = array_max; var x = new Array(1, 2, 3, 4, 5, 6); var y = x.max( );All intrinsic JScript objects have a prototype property that is read-only. Functionality may be added to the prototype, as in the example, but the object may not be assigned a different prototype.
This is not the case for user-defined objects: User-defined objects may be assigned a new prototype.
The method and property lists for each intrinsic object in this language reference indicate which ones are part of the object's prototype, and which are not.
© 1997 by Microsoft Corporation. All rights reserved.
file: /Techref/language/jscript/js551.htm, 3KB, , updated: 1997/9/30 03:44, local time: 2024/8/22 03:28,
18.219.230.43:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://piclist.com/tecHREF/language/jscript/js551.htm"> prototype Property</A> |
Did you find what you needed? |
![]() o List host: MIT, Site host massmind.org, Top posters @none found - Page Editors: James Newton, David Cary, and YOU! * Roman Black of Black Robotics donates from sales of Linistep stepper controller kits. * Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters. * Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated! * Contributors: Richard Seriani, Sr. |
Ashley Roll has put together a really nice little unit here. Leave off the MAX232 and keep these handy for the few times you need true RS232! |
.