mozilla

Compare Revisions

Object.prototype.valueOf()

Change Revisions

Revision 264697:

Revision 264697 by Sevenspade on

Revision 264841:

Revision 264841 by gary.court on

Title:
valueOf
JavaScript/Reference/Global_Objects/Object/valueOf
Slug:
JavaScript/Reference/Global_Objects/Object/valueOf
JavaScript/Reference/Global_Objects/Object/valueOf
Tags:
JavaScript, "JavaScript Reference", Object
JavaScript, "JavaScript Reference", Object
Content:

Revision 264697
Revision 264841
n20            Method of <a href="/en/JavaScript/Reference/Global_Obn20            Method of <a href="/en/JavaScript/Reference/Global_Ob
>jects/Object"><code>Object</code></a>>jects/Object" title="en/JavaScript/Reference/Global_Objects/Objec
 >t"><code>Object</code></a>
n68      You can use <code>valueOf</code> within your own code to con68      You can use <code>valueOf</code> within your own code to co
>nvert a built-in object into a primitive value. When you create a>nvert a built-in object into a primitive value. When you create a
> custom object, you can override <code>Object.valueOf</code> to c> custom object, you can override <code>Object.prototype.valueOf</
>all a custom method instead of the default <code>Object</code> me>code> to call a custom method instead of the default <code>Object
>thod.></code> method.
t80myNumberType.prototype.valueOf = new Function(functionText)t80myNumberType.prototype.valueOf = function () { return customPrimi
 >tiveValue; };

Back to History