aboutsummaryrefslogtreecommitdiff
path: root/files/ca/web/javascript/reference/global_objects/object
diff options
context:
space:
mode:
authorFlorian Merz <me@fiji-flo.de>2021-02-11 14:45:12 +0100
committerFlorian Merz <me@fiji-flo.de>2021-02-11 14:45:12 +0100
commitcb9e359a51c3249d8f5157db69d43fd413ddeda6 (patch)
treeae3040d626c3b5717da5bda2af9f0a9ff9bd389f /files/ca/web/javascript/reference/global_objects/object
parent8260a606c143e6b55a467edf017a56bdcd6cba7e (diff)
downloadtranslated-content-cb9e359a51c3249d8f5157db69d43fd413ddeda6.tar.gz
translated-content-cb9e359a51c3249d8f5157db69d43fd413ddeda6.tar.bz2
translated-content-cb9e359a51c3249d8f5157db69d43fd413ddeda6.zip
unslug ca: move
Diffstat (limited to 'files/ca/web/javascript/reference/global_objects/object')
-rw-r--r--files/ca/web/javascript/reference/global_objects/object/prototype/index.html215
1 files changed, 0 insertions, 215 deletions
diff --git a/files/ca/web/javascript/reference/global_objects/object/prototype/index.html b/files/ca/web/javascript/reference/global_objects/object/prototype/index.html
deleted file mode 100644
index 9451ccfefe..0000000000
--- a/files/ca/web/javascript/reference/global_objects/object/prototype/index.html
+++ /dev/null
@@ -1,215 +0,0 @@
----
-title: Object.prototype
-slug: Web/JavaScript/Reference/Global_Objects/Object/prototype
-translation_of: Web/JavaScript/Reference/Global_Objects/Object
-translation_of_original: Web/JavaScript/Reference/Global_Objects/Object/prototype
----
-<div>{{JSRef}}</div>
-
-<p>La propietat <code><strong>Object.prototype</strong></code> representa el prototipus per a {{jsxref("Object")}}.</p>
-
-<div>{{js_property_attributes(0, 0, 0)}}</div>
-
-<h2 id="Descripció">Descripció</h2>
-
-<p>A JavaScript, tots els objectes hereten de {{jsxref("Object")}}; tots els objectes hereten els mètodes i propietats de <code>Object.prototype</code>, tot i que es poden sobreescriure (excepte un <code>Object</code> amb prototipus <code>null</code>, és a dir, <code>Object.create(null)</code>). Per exemple, altres prototipus de constructors sobreescriuen la propietat <code>constructor</code> i ofereixen els seus propis mètodes {{jsxref("Object.prototype.toString()", "toString()")}}. Els canvis al prototipus <code>Object</code> es propaguen a tots els objectes a no ser que les propietats i mètodes que reben aquests canvis hagin sigut sobreescrites més avall a la cadena de prototipus.</p>
-
-<h2 id="Propietats">Propietats</h2>
-
-<dl>
- <dt>{{jsxref("Object.prototype.constructor")}}</dt>
- <dd>Especifica la funció que ha creat el prototipus de l'objecte.</dd>
- <dt>{{jsxref("Object.prototype.__proto__")}} {{non-standard_inline}}</dt>
- <dd>Referencia l'objecte utilitzat com a prototipus quan aquest objecte va ser instanciat.</dd>
- <dt>{{jsxref("Object.prototype.__noSuchMethod__")}} {{non-standard_inline}}</dt>
- <dd>Permet definir una funció que serà executada quan es cridi com mètode un membre no definit.</dd>
- <dt><s class="obsoleteElement">{{jsxref("Object.prototype.__count__")}} {{obsolete_inline}}</s></dt>
- <dd><s class="obsoleteElement">Retornava el nombre de propietats enumerables que hi hagués a un objecte definit per l'usuari. S'ha eliminat.</s></dd>
- <dt><s class="obsoleteElement">{{jsxref("Object.prototype.__parent__")}} {{obsolete_inline}}</s></dt>
- <dd><s class="obsoleteElement">Referenciava el context d'un objecte. S'ha eliminat.</s></dd>
-</dl>
-
-<h2 id="Mètodes">Mètodes</h2>
-
-<dl>
- <dt>{{jsxref("Object.prototype.__defineGetter__()")}} {{non-standard_inline}} {{deprecated_inline}}</dt>
- <dd>Associa una funció a una propietat que, quan s'accedeix, executa aquesta funció i retorna el seu valor.</dd>
- <dt>{{jsxref("Object.prototype.__defineSetter__()")}} {{non-standard_inline}} {{deprecated_inline}}</dt>
- <dd>Associa una funció a una propietat que, quan s'assigna, executa aquesta funció que modifica la propietat.</dd>
- <dt>{{jsxref("Object.prototype.__lookupGetter__()")}} {{non-standard_inline}} {{deprecated_inline}}</dt>
- <dd>Retorna una funció associada a la propietat especificada pel mètode {{jsxref("Object.defineGetter", "__defineGetter__")}}.</dd>
- <dt>{{jsxref("Object.prototype.__lookupSetter__()")}} {{non-standard_inline}} {{deprecated_inline}}</dt>
- <dd>Retorna a funció associada a la propietat especificada pel mètode {{jsxref("Object.defineSetter", "__defineSetter__")}}.</dd>
- <dt>{{jsxref("Object.prototype.hasOwnProperty()")}}</dt>
- <dd>Retorna un booleà que indica si l'objecte conté la propietat especificada com una propietat pròpia d'ell mateix en comptes d'heretar-la a través de la cadena de prototipus.</dd>
- <dt>{{jsxref("Object.prototype.isPrototypeOf()")}}</dt>
- <dd>Retorna un booleà que indica si l'objecte espeicfifcat pertany a la cadena de prototipus de l'objecte sobre el que es crida aquest mètode.</dd>
- <dt>{{jsxref("Object.prototype.propertyIsEnumerable()")}}</dt>
- <dd>Retorna un booleà que indica si està activat l'atribut intern <a href="/en-US/docs/ECMAScript_DontEnum_attribute" title="ECMAScript_DontEnum_attribute">DontEnum de l'ECMAScript</a>.</dd>
- <dt>{{jsxref("Object.prototype.toSource()")}} {{non-standard_inline}}</dt>
- <dd>Retorna un string que conté cofi font que defineix un literal d'objecte que representa l'objecte sobre el que s'executa aquest mètode; aquest valor pot utilitzar-se per a crear un nou objecte.</dd>
- <dt>{{jsxref("Object.prototype.toLocaleString()")}}</dt>
- <dd>Crida el mètode {{jsxref("Object.toString", "toString()")}}.</dd>
- <dt>{{jsxref("Object.prototype.toString()")}}</dt>
- <dd>Retorna una representació d'aquest objecte en forma de string.</dd>
- <dt>{{jsxref("Object.prototype.unwatch()")}} {{non-standard_inline}}</dt>
- <dd>Esborra un <em>watchpoint</em> d'una propietat de l'objecte.</dd>
- <dt>{{jsxref("Object.prototype.valueOf()")}}</dt>
- <dd>Retorna el valor primitiu de l'objecte especificat.</dd>
- <dt>{{jsxref("Object.prototype.watch()")}} {{non-standard_inline}}</dt>
- <dd>Afegeix un <em>watchpoint</em> a una propietat de l'objecte.</dd>
- <dt><s class="obsoleteElement">{{jsxref("Object.prototype.eval()")}} {{obsolete_inline}}</s></dt>
- <dd><s class="obsoleteElement">Evaluava un string de codi font JavaScript dins el context de l'objecte especificat. S'ha eliminat.</s></dd>
-</dl>
-
-<h2 id="Exemples">Exemples</h2>
-
-<p>Degut a que JavaScript no res semblant a subclasses d'objectes, la propietat <code>prototype</code> és una bona forma d'utilitzar algunes funcions que fan d'objectes com a "classe base". Per exemple:</p>
-
-<pre class="brush: js">var Person = function() {
- this.canTalk = true;
-};
-
-Person.prototype.greet = function() {
- if (this.canTalk) {
- console.log('Hi, I am ' + this.name);
- }
-};
-
-var Employee = function(name, title) {
- Person.call(this);
- this.name = name;
- this.title = title;
-};
-
-Employee.prototype = Object.create(Person.prototype);
-Employee.prototype.constructor = Employee;
-
-Employee.prototype.greet = function() {
- if (this.canTalk) {
- console.log('Hi, I am ' + this.name + ', the ' + this.title);
- }
-};
-
-var Customer = function(name) {
- Person.call(this);
- this.name = name;
-};
-
-Customer.prototype = Object.create(Person.prototype);
-Customer.prototype.constructor = Customer;
-
-var Mime = function(name) {
- Person.call(this);
- this.name = name;
- this.canTalk = false;
-};
-
-Mime.prototype = Object.create(Person.prototype);
-Mime.prototype.constructor = Mime;
-
-var bob = new Employee('Bob', 'Builder');
-var joe = new Customer('Joe');
-var rg = new Employee('Red Green', 'Handyman');
-var mike = new Customer('Mike');
-var mime = new Mime('Mime');
-
-bob.greet();
-// Hi, I am Bob, the Builder
-
-joe.greet();
-// Hi, I am Joe
-
-rg.greet();
-// Hi, I am Red Green, the Handyman
-
-mike.greet();
-// Hi, I am Mike
-
-mime.greet();
-</pre>
-
-<h2 id="Especificacions">Especificacions</h2>
-
-<table class="standard-table">
- <tbody>
- <tr>
- <th scope="col">Especificació</th>
- <th scope="col">Estat</th>
- <th scope="col">Comentaris</th>
- </tr>
- <tr>
- <td>{{SpecName('ES1')}}</td>
- <td>{{Spec2('ES1')}}</td>
- <td>Definició inicial. Implementat a JavaScript 1.0.</td>
- </tr>
- <tr>
- <td>{{SpecName('ES5.1', '#sec-15.2.3.1', 'Object.prototype')}}</td>
- <td>{{Spec2('ES5.1')}}</td>
- <td> </td>
- </tr>
- <tr>
- <td>{{SpecName('ES6', '#sec-object.prototype', 'Object.prototype')}}</td>
- <td>{{Spec2('ES6')}}</td>
- <td> </td>
- </tr>
- </tbody>
-</table>
-
-<h2 id="Compatibilitat_amb_navegadors">Compatibilitat amb navegadors</h2>
-
-<div>{{CompatibilityTable}}</div>
-
-<div id="compat-desktop">
-<table class="compat-table">
- <tbody>
- <tr>
- <th>Característica</th>
- <th>Chrome</th>
- <th>Firefox (Gecko)</th>
- <th>Internet Explorer</th>
- <th>Opera</th>
- <th>Safari</th>
- </tr>
- <tr>
- <td>Suport bàsic</td>
- <td>{{CompatVersionUnknown}}</td>
- <td>{{CompatVersionUnknown}}</td>
- <td>{{CompatVersionUnknown}}</td>
- <td>{{CompatVersionUnknown}}</td>
- <td>{{CompatVersionUnknown}}</td>
- </tr>
- </tbody>
-</table>
-</div>
-
-<div id="compat-mobile">
-<table class="compat-table">
- <tbody>
- <tr>
- <th>Característica</th>
- <th>Android</th>
- <th>Chrome for Android</th>
- <th>Firefox Mobile (Gecko)</th>
- <th>IE Mobile</th>
- <th>Opera Mobile</th>
- <th>Safari Mobile</th>
- </tr>
- <tr>
- <td>Suport bàsic</td>
- <td>{{CompatVersionUnknown}}</td>
- <td>{{CompatVersionUnknown}}</td>
- <td>{{CompatVersionUnknown}}</td>
- <td>{{CompatVersionUnknown}}</td>
- <td>{{CompatVersionUnknown}}</td>
- <td>{{CompatVersionUnknown}}</td>
- </tr>
- </tbody>
-</table>
-</div>
-
-<h2 id="Vegeu_també"> Vegeu també</h2>
-
-<ul>
- <li><a href="/en-US/docs/Web/JavaScript/Introduction_to_Object-Oriented_JavaScript">Introducció al JavaScript orientat a objectes</a></li>
-</ul>