Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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