Intro Constructor Function

by Ken Sprague

JavaScript

class ComicInfo{
    constructor(title, issue, grade){
      this.title = title;
      this.issue = issue;
      this.grade = grade;
      this.getComicInfo = function(){
        return '${this.title} ${this.issue} ${this.grade}';
      }
   }
    getComicInfo2(){
    	return '${this.title} ${this.issue} ${this.grade}';
    }
   }
 
 ComicInfo.prototype.greeting = function(){
 		console.log("Your favorite comic, " + this.title + " has been added to your collection");
 };
 
 var myNewComicInfo = new ComicInfo("Amazing Spider-Man", "129", "Graded");
 console.log(myNewComicInfo);

myNewComicInfo.greeting();

/*var comic1 = new ComicInfo("Amazing Spiderman", "129", "9.4");
var comic2 = new ComicInfo("Werewolf by Night", "32", "9.8");
var comic3 = new ComicInfo("Batman", "232", "9.6");


console.log(comic1);
console.log(comic2);
console.log(comic3);
comic1.greeting();
comic2.greeting();
comic3.greeting(); */