I have a definition of a method as a function which belongs to an object, and I have the code below. But I think the book is telling me that the function is a class. So, is it both a class and a method?

var star = {}

function Star(constell,type,specclass,magnitude) {
this.constellation = constell;
this.type = type;
this.spectralClass = specclass;
this.mag = magnitude;

star["Polaris"] = new Star("Ursa Minor","Double/Cephid","F7",2.0);
Oh, wait, I think I get it...In the function, "Star" begins with upper-case, where in the first line, and the "star["Polaris"] line, it's lowercase. So, now, I think that's telling me that I could have called the function anything -- "SAM", for instance, and then I would have coded star["Polaris"]=new SAM...

Just typing this here, I think shined the light for me. If so, it's a subtle difference in the book, that I wish the author had pointed out.