12. teach snoopy


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???

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() {

// 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!

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

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

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) {
also in this function, p is parameter? or argument?

what should I do to know exactly the JS terminology?


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