<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ca">
		<id>http://wikiserver.infomerce.es/index.php?action=history&amp;feed=atom&amp;title=Solucio_sobrecarrega_de_funcions</id>
		<title>Solucio sobrecarrega de funcions - Historial de revisió</title>
		<link rel="self" type="application/atom+xml" href="http://wikiserver.infomerce.es/index.php?action=history&amp;feed=atom&amp;title=Solucio_sobrecarrega_de_funcions"/>
		<link rel="alternate" type="text/html" href="http://wikiserver.infomerce.es/index.php?title=Solucio_sobrecarrega_de_funcions&amp;action=history"/>
		<updated>2026-05-09T16:24:26Z</updated>
		<subtitle>Historial de revisió per a aquesta pàgina del wiki</subtitle>
		<generator>MediaWiki 1.28.0</generator>

	<entry>
		<id>http://wikiserver.infomerce.es/index.php?title=Solucio_sobrecarrega_de_funcions&amp;diff=8405&amp;oldid=prev</id>
		<title>Jnoguera a 16:38, 11 oct 2017</title>
		<link rel="alternate" type="text/html" href="http://wikiserver.infomerce.es/index.php?title=Solucio_sobrecarrega_de_funcions&amp;diff=8405&amp;oldid=prev"/>
				<updated>2017-10-11T16:38:21Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;' lang='ca'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Versió més antiga&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revisió del 16:38, 11 oct 2017&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;Línia 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Línia 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; 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;&amp;lt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;pre&lt;/del&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; 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;&amp;lt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;source lang=&amp;quot;java&amp;quot;&lt;/ins&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;function afegirMetode(objecte, nom, funcio){&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;function afegirMetode(objecte, nom, funcio){&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	var old = objecte[nom];&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;	var old = objecte[nom];&lt;/div&gt;&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-l40&quot; &gt;Línia 40:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Línia 40:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;alert(&amp;quot;Crida a la funcio amb el parametre 'a': \n &amp;quot; + usuaris.trobar('a'));&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;alert(&amp;quot;Crida a la funcio amb el parametre 'a': \n &amp;quot; + usuaris.trobar('a'));&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;alert(&amp;quot;Crida a la funcio amb els parametres 'jaume' i 'pontons': \n &amp;quot; + usuaris.trobar('jaume','pontons'));&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;alert(&amp;quot;Crida a la funcio amb els parametres 'jaume' i 'pontons': \n &amp;quot; + usuaris.trobar('jaume','pontons'));&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; 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;&amp;lt;/&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;pre&lt;/del&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; 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;&amp;lt;/&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;source&lt;/ins&gt;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Jnoguera</name></author>	</entry>

	<entry>
		<id>http://wikiserver.infomerce.es/index.php?title=Solucio_sobrecarrega_de_funcions&amp;diff=365&amp;oldid=prev</id>
		<title>Asalinas: Es crea la pàgina amb «&lt;pre&gt; function afegirMetode(objecte, nom, funcio){ 	var old = objecte[nom]; 	objecte[nom] = function(){ 				if(funcio.length == arguments.length)	 					return funcio.appl…».</title>
		<link rel="alternate" type="text/html" href="http://wikiserver.infomerce.es/index.php?title=Solucio_sobrecarrega_de_funcions&amp;diff=365&amp;oldid=prev"/>
				<updated>2013-11-10T05:23:00Z</updated>
		
		<summary type="html">&lt;p&gt;Es crea la pàgina amb «&amp;lt;pre&amp;gt; function afegirMetode(objecte, nom, funcio){ 	var old = objecte[nom]; 	objecte[nom] = function(){ 				if(funcio.length == arguments.length)	 					return funcio.appl…».&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Pàgina nova&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
function afegirMetode(objecte, nom, funcio){&lt;br /&gt;
	var old = objecte[nom];&lt;br /&gt;
	objecte[nom] = function(){&lt;br /&gt;
				if(funcio.length == arguments.length)	&lt;br /&gt;
					return funcio.apply(this, arguments);&lt;br /&gt;
				else if (typeof old == 'function')&lt;br /&gt;
					return old.apply(this, arguments);&lt;br /&gt;
		};&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
var usuaris = {&lt;br /&gt;
       noms : [&amp;quot;joan garcia&amp;quot;, &amp;quot;jaume pontons&amp;quot;, &amp;quot;ana riu&amp;quot;, &amp;quot;marta aran&amp;quot;, &amp;quot;alex fornell&amp;quot;, &amp;quot;mariona cots&amp;quot;]&lt;br /&gt;
	};&lt;br /&gt;
&lt;br /&gt;
// afegim funció sense paràmetres&lt;br /&gt;
afegirMetode(usuaris, &amp;quot;trobar&amp;quot;, function(){ return this.noms; } );&lt;br /&gt;
&lt;br /&gt;
//afegir funció amb 1 paràmetre&lt;br /&gt;
afegirMetode(usuaris, &amp;quot;trobar&amp;quot;, function (cadena){&lt;br /&gt;
		var ret = [];&lt;br /&gt;
		for(var i = 0; i &amp;lt; this.noms.length; i++)&lt;br /&gt;
			if(this.noms[i].indexOf(cadena) == 0)	&lt;br /&gt;
				ret.push(this.noms[i]);&lt;br /&gt;
		return ret;		&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
//afegir funció amb 2 paràmetres&lt;br /&gt;
afegirMetode(usuaris, &amp;quot;trobar&amp;quot;, function(nom, cognom){&lt;br /&gt;
	var ret = [];&lt;br /&gt;
	for(var i = 0; i &amp;lt; this.noms.length; i++)&lt;br /&gt;
		if(this.noms[i]  == (nom + &amp;quot; &amp;quot; + cognom))&lt;br /&gt;
			ret.push(this.noms[i]);&lt;br /&gt;
	return ret;			&lt;br /&gt;
});&lt;br /&gt;
&lt;br /&gt;
//prova-ho:&lt;br /&gt;
&lt;br /&gt;
alert(&amp;quot;Crida a la funcio sense parametres: \n &amp;quot; + usuaris.trobar());&lt;br /&gt;
alert(&amp;quot;Crida a la funcio amb el parametre 'a': \n &amp;quot; + usuaris.trobar('a'));&lt;br /&gt;
alert(&amp;quot;Crida a la funcio amb els parametres 'jaume' i 'pontons': \n &amp;quot; + usuaris.trobar('jaume','pontons'));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Asalinas</name></author>	</entry>

	</feed>