<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://replica.wiki.extremist.software/index.php?action=history&amp;feed=atom&amp;title=JavaScript%2FNotes%2FFunction%2FTemplate%3AFunctions_Double_as_Constructor</id>
	<title>JavaScript/Notes/Function/Template:Functions Double as Constructor - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://replica.wiki.extremist.software/index.php?action=history&amp;feed=atom&amp;title=JavaScript%2FNotes%2FFunction%2FTemplate%3AFunctions_Double_as_Constructor"/>
	<link rel="alternate" type="text/html" href="https://replica.wiki.extremist.software/index.php?title=JavaScript/Notes/Function/Template:Functions_Double_as_Constructor&amp;action=history"/>
	<updated>2026-04-03T17:11:55Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.13</generator>
	<entry>
		<id>https://replica.wiki.extremist.software/index.php?title=JavaScript/Notes/Function/Template:Functions_Double_as_Constructor&amp;diff=46025&amp;oldid=prev</id>
		<title>Fnord: Undo revision 45943 by IgAZwmawpK (talk)</title>
		<link rel="alternate" type="text/html" href="https://replica.wiki.extremist.software/index.php?title=JavaScript/Notes/Function/Template:Functions_Double_as_Constructor&amp;diff=46025&amp;oldid=prev"/>
		<updated>2015-01-01T00:21:40Z</updated>

		<summary type="html">&lt;p&gt;Undo revision 45943 by &lt;a href=&quot;/wiki/Special:Contributions/IgAZwmawpK&quot; title=&quot;Special:Contributions/IgAZwmawpK&quot;&gt;IgAZwmawpK&lt;/a&gt; (&lt;a href=&quot;/index.php?title=User_talk:IgAZwmawpK&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;User talk:IgAZwmawpK (page does not exist)&quot;&gt;talk&lt;/a&gt;)&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 17:21, 31 December 2014&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Functions&amp;#039; prototype Property ==  &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Functions&amp;#039; prototype Property ==  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Every user-defined &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;func[[File:Past1.jpg]]&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Every user-defined &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;function &lt;/ins&gt;gets a prototype property for free. This property is assigned to the instance&amp;#039;s &amp;lt;nowiki&amp;gt;[[Prototype]]&amp;lt;/nowiki&amp;gt; and is used for prototype inheritance, or &amp;quot;shared properties&amp;quot; of each instance.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[File:Past2.jpg]]&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[File:Present1.jpg]]&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tion &lt;/del&gt;gets a prototype property for free. This property is assigned to the instance&amp;#039;s &amp;lt;nowiki&amp;gt;[[Prototype]]&amp;lt;/nowiki&amp;gt; and is used for prototype inheritance, or &amp;quot;shared properties&amp;quot; of each instance.&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;function Colorized(name, favoriteColor) {&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;function Colorized(name, favoriteColor) {&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key noisebridge_mediawiki-wiki_:diff::1.12:old-45943:rev-46025 --&gt;
&lt;/table&gt;</summary>
		<author><name>Fnord</name></author>
	</entry>
	<entry>
		<id>https://replica.wiki.extremist.software/index.php?title=JavaScript/Notes/Function/Template:Functions_Double_as_Constructor&amp;diff=45943&amp;oldid=prev</id>
		<title>IgAZwmawpK at 21:14, 30 December 2014</title>
		<link rel="alternate" type="text/html" href="https://replica.wiki.extremist.software/index.php?title=JavaScript/Notes/Function/Template:Functions_Double_as_Constructor&amp;diff=45943&amp;oldid=prev"/>
		<updated>2014-12-30T21:14:04Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 14:14, 30 December 2014&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Functions&amp;#039; prototype Property ==  &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Functions&amp;#039; prototype Property ==  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Every user-defined &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;function &lt;/del&gt;gets a prototype property for free. This property is assigned to the instance&amp;#039;s &amp;lt;nowiki&amp;gt;[[Prototype]]&amp;lt;/nowiki&amp;gt; and is used for prototype inheritance, or &amp;quot;shared properties&amp;quot; of each instance.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Every user-defined &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;func[[File:Past1.jpg]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[File:Past2.jpg]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[File:Present1.jpg]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;tion &lt;/ins&gt;gets a prototype property for free. This property is assigned to the instance&amp;#039;s &amp;lt;nowiki&amp;gt;[[Prototype]]&amp;lt;/nowiki&amp;gt; and is used for prototype inheritance, or &amp;quot;shared properties&amp;quot; of each instance.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;function Colorized(name, favoriteColor) {&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;function Colorized(name, favoriteColor) {&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key noisebridge_mediawiki-wiki_:diff::1.12:old-43877:rev-45943 --&gt;
&lt;/table&gt;</summary>
		<author><name>IgAZwmawpK</name></author>
	</entry>
	<entry>
		<id>https://replica.wiki.extremist.software/index.php?title=JavaScript/Notes/Function/Template:Functions_Double_as_Constructor&amp;diff=43877&amp;oldid=prev</id>
		<title>Garrett: Created page with &quot;== Functions&#039; prototype Property ==  Every user-defined function gets a prototype property for free. This property is assigned to the instance&#039;s &lt;nowiki&gt;Prototype&lt;/nowiki&gt;...&quot;</title>
		<link rel="alternate" type="text/html" href="https://replica.wiki.extremist.software/index.php?title=JavaScript/Notes/Function/Template:Functions_Double_as_Constructor&amp;diff=43877&amp;oldid=prev"/>
		<updated>2014-08-12T19:05:34Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;== Functions&amp;#039; prototype Property ==  Every user-defined function gets a prototype property for free. This property is assigned to the instance&amp;#039;s &amp;lt;nowiki&amp;gt;&lt;a href=&quot;/index.php?title=Prototype&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Prototype (page does not exist)&quot;&gt;Prototype&lt;/a&gt;&amp;lt;/nowiki&amp;gt;...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Functions&amp;#039; prototype Property == &lt;br /&gt;
Every user-defined function gets a prototype property for free. This property is assigned to the instance&amp;#039;s &amp;lt;nowiki&amp;gt;[[Prototype]]&amp;lt;/nowiki&amp;gt; and is used for prototype inheritance, or &amp;quot;shared properties&amp;quot; of each instance.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
function Colorized(name, favoriteColor) {&lt;br /&gt;
  this.name = name;&lt;br /&gt;
  this.favoriteColor = favoriteColor;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// alert(Colorized.prototype); // we get prototype for free.&lt;br /&gt;
Colorized.prototype.toString = function() {&lt;br /&gt;
  return this.name + &amp;quot;, &amp;quot; + this.favoriteColor;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
var c = new Colorized(&amp;quot;Mary&amp;quot;, &amp;quot;red&amp;quot;);&lt;br /&gt;
alert(c.toString());&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The toString method is called by the engine when a primitive String value is required. For example, when calling the String constructor as a function, the engine finds the toString method and calls it.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
alert( String(c) );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
However, when string concatenation is performed, the hint for the primitive value is not string. Instead, the Object&amp;#039;s valueOf may be called.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
var o = {&lt;br /&gt;
  name : &amp;quot;Greg&amp;quot;,&lt;br /&gt;
  toString : function() {&lt;br /&gt;
    return &amp;quot;[object &amp;quot; +this.name + &amp;quot;]&amp;quot;;&lt;br /&gt;
  },&lt;br /&gt;
  valueOf : function() {&lt;br /&gt;
    return 10;&lt;br /&gt;
  }&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
alert( o + &amp;quot; is valued at &amp;quot; + (+o)); // &amp;quot;10 is valued at 10&amp;quot;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Garrett</name></author>
	</entry>
</feed>