Apply your JS skills to key Mozilla projects as an MDN Fellow! http://mzl.la/MDNFellowship

mozilla

Compare Revisions

Defining Getters and Setters

Change Revisions

Revision 57922:

Revision 57922 by Davigoli on

Revision 57923:

Revision 57923 by Davigoli on

Title:
Defining Getters and Setters
Defining Getters and Setters
Slug:
JavaScript/Guide/Obsolete_Pages/Creating_New_Objects/Defining_Getters_and_Setters
JavaScript/Guide/Obsolete_Pages/Creating_New_Objects/Defining_Getters_and_Setters
Tags:
JavaScript, Firefox, get, set, getter, setter, property
JavaScript, Firefox, get, set, getter, setter, property
Content:

Revision 57922
Revision 57923
n30js> o.an30js> o.a;
n32js> o.bn32js> o.b;
n34js> o.c = 50n34js> o.c = 50;
35js> o.a35js> o.a;
n57js> now.year=2001;n57js> now.year = 2001;
n99        Prior to Firefox 3.0, getter and setter are not supportedn99        Prior to Firefox 3.0, getter and setter are not supported
> for DOM Elements. Older versions of Firefox silently fail. If ex> for DOM Elements. Older versions of Firefox silently fail. If ex
>ceptions are needed for those, changing the prototype of HTMLElem>ceptions are needed for those, changing the prototype of HTMLElem
>ent <code>(HTMLElement.prototype.__define{{mediawiki.external('SG>ent <code>(HTMLElement.prototype.__define{{ mediawiki.external('S
>')}}etter__)</code> and throwing an exception is a workaround.>G') }}etter__)</code> and throwing an exception is a workaround.
n103      {{template.PreviousNext("Core_JavaScript_1.5_Guide:Creatingn103      {{ PreviousNext("Core_JavaScript_1.5_Guide:Creating_New_Obj
>_New_Objects:Using_this_for_Object_References", "Core_JavaScript_>ects:Using_this_for_Object_References", "Core_JavaScript_1.5_Guid
>1.5_Guide:Creating_New_Objects:Deleting_Properties")}}>e:Creating_New_Objects:Deleting_Properties") }}
t105    <div class="noinclude"></div>{{ wiki.languages( { "es": "es/Gt105    <div class="noinclude"></div>{{ languages( { "es": "es/Gu\u00
>u\u00eda_JavaScript_1.5/Crear_nuevos_objetos/Definiendo_las_funci>eda_JavaScript_1.5/Crear_nuevos_objetos/Definiendo_las_funciones_
>ones_get_y_set", "fr": "fr/Guide_JavaScript_1.5/Cr\u00e9ation_d\'>get_y_set", "fr": "fr/Guide_JavaScript_1.5/Cr\u00e9ation_d\'objet
>objets/D\u00e9finition_d\'accesseurs_et_de_mutateurs", "ja": "ja/>s/D\u00e9finition_d\'accesseurs_et_de_mutateurs", "ja": "ja/Core_
>Core_JavaScript_1.5_Guide/Creating_New_Objects/Defining_Getters_a>JavaScript_1.5_Guide/Creating_New_Objects/Defining_Getters_and_Se
>nd_Setters", "ko": "ko/Core_JavaScript_1.5_Guide/Creating_New_Obj>tters", "ko": "ko/Core_JavaScript_1.5_Guide/Creating_New_Objects/
>ects/Defining_Getters_and_Setters", "pl": "pl/Przewodnik_po_j\u01>Defining_Getters_and_Setters", "pl": "pl/Przewodnik_po_j\u0119zyk
>19zyku_JavaScript_1.5/Tworzenie_nowych_obiekt\u00f3w/Definiowanie>u_JavaScript_1.5/Tworzenie_nowych_obiekt\u00f3w/Definiowanie_meto
>_metod_pobierania_i_ustawiania" } ) }}>d_pobierania_i_ustawiania" } ) }}

Back to History