Skip to content

Instantly share code, notes, and snippets.

@GAierken
Created September 4, 2020 02:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GAierken/5c69346d0dd6fc00784ce38d594d18c4 to your computer and use it in GitHub Desktop.
Save GAierken/5c69346d0dd6fc00784ce38d594d18c4 to your computer and use it in GitHub Desktop.
let movie1 = function () {}
movie1.prototype.description = function() {
return "description of movie1"
}
let movie2 = function() {}
movie2.prototype = Object.create(movie1.prototype);
movie2.prototype.description = function() {
return "description of movie2"
}
let movie3 = function() {}
movie3.prototype = Object.create(movie1.prototype);
movie3.prototype.description = function() {
return "description of movie3"
}
let movies = [new movie1(), new movie2(), new movie3()];
movies.forEach(function(movie){
console.log(movie.description());
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment