Created
July 28, 2017 16:09
-
-
Save NrI3/287b05760fa1eba1b406555b647cf268 to your computer and use it in GitHub Desktop.
Helper JS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Constructor | |
| # Muestra la funcion del constructor a la que pertenece dicho objeto | |
| Objetc.consturctor | |
| # Prototype | |
| # Muestra la lista de propiedades y metodos del objeto sin haber sido inicializado | |
| # Toda modificacion que se realice en el objeto se hereda a los objetos que hereden este objeto | |
| #Ejemplo | |
| Object.prototype.testString = "Esto se heredara a cualquier objeto de tipo Object" | |
| var x = new Object(); | |
| x.testString | |
| # Modificando las propiedades de HTMLHtmlElement para mostrar children como list | |
| # ya que si intentamos modificar la propiedad directamente nos salta error | |
| # Forma apropiada de definir una propiedad sin llamar a una funcion | |
| HTMLHtmlElement.prototype.__defineGetter__( 'list', function(){ return this.children } ) | |
| # Error al definir la misma en forma directa | |
| HTMLHtmlElement.prototype.list = HTMLHtmlElement.prototype.children | |
| # Definirla en forma de funcion | |
| HTMLHtmlElement.prototype.list = function(){ this.list = this.children } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment