Skip to content

Instantly share code, notes, and snippets.

@stiofand
Created December 12, 2014 13:36
Show Gist options
  • Save stiofand/27765848fa49d98461e2 to your computer and use it in GitHub Desktop.
Save stiofand/27765848fa49d98461e2 to your computer and use it in GitHub Desktop.
vEGmoP
function Person(name, age, job) {
this.name = name;
this.age = age;
this.job = job;
this.sayName = function() {
console.log(this.name);
};
}
(function(){
var p = new Person("Jo",20,"dev");
console.log(typeof new Person);
console.log(typeof Person);
console.log(typeof p);
console.log(p.sayName()); // Why do you think this is undefined?
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment