-
-
Save nebiros/16bd12e780e29a376e30 to your computer and use it in GitHub Desktop.
This file contains 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
function Blah() { // función constructora, constructor o clase | |
this.value = 42; // atributo | |
} | |
Blah.prototype = { // atributo 'prototype' | |
constructor: Blah, // atributo 'constructor' | |
method: function() { // método | |
return "hiya!"; | |
} | |
}; | |
// una instancia de Blah | |
var blah = new Blah(); | |
// el valor de nuestro atributo 'value' | |
console.log(blah.value); // 42 | |
// lo que retorna nuestro método 'method' | |
console.log(blah.method()); // hiya! | |
// uno de los métodos que heredamos de 'Object' | |
console.log(blah.toString()); // [object Object] | |
// el tipo de 'method' | |
console.log(typeof blah.method); // function | |
// constructor | |
console.log(blah.constructor === Blah); // true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment