12. teach snoopy


#1


I think I get confused often with some terminology. In this case they call that constructor and then prototype. "Dog constructor ensures that the Dog prototype has a breed property"
Also sometimes it is called object or constructor. very confusing........
how about you guys??
anyone who can hep me???
please~~


`
unction Dog (breed) {
this.breed = breed;
}

// here we make buddy and teach him how to bark
var buddy = new Dog("Golden Retriever");
buddy.bark = function() {
console.log("Woof");
};
buddy.bark();

// here we make snoopy
var snoopy = new Dog("Beagle");
// we need you to teach snoopy how to bark here

// this causes an error, because snoopy doesn't know how to bark!
snoopy.bark();

.`
function Dog (breed) {
this.breed = breed;
}

Is this Dog object? or Dog constructor? or Dog class??

ALSO
var buddy = new Dog("Golden Retriever");
is this buddy constructor? or object?
I think in this case it's buddy object. but what' the difference between object and variance??

when I make variance I do like this.
var x = y but to me it looks similar with the buddy object .

var printPersonName = function (p) {
console.log(p.name);
};
also in this function, p is parameter? or argument?

what should I do to know exactly the JS terminology?


#2

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.