{"size": 1321, "ext": "js", "max_stars_repo_path": "articles/javascriptissexy/javascript-prototype-in-plain-detailed-language.js", "max_stars_repo_name": "mohammedelzanaty/myRoad2BeFullStack", "max_stars_repo_stars_event_min_datetime": "2021-04-21T12:05:01.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-19T09:58:38.000Z", "max_issues_repo_path": "articles/javascriptissexy/javascript-prototype-in-plain-detailed-language.js", "max_issues_repo_name": "mohammedelzanaty/myRoad2BeFullStack", "max_issues_repo_issues_event_min_datetime": "2019-12-26T11:21:42.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-27T19:55:10.000Z", "max_forks_repo_path": "articles/javascriptissexy/javascript-prototype-in-plain-detailed-language.js", "max_forks_repo_name": "mohammedelzanaty/myRoad2BeFullStack", "max_forks_repo_forks_event_min_datetime": "2021-08-15T07:59:36.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-16T06:17:32.000Z"}
{"max_stars_count": 2, "max_issues_count": 34, "max_forks_count": 2, "avg_line_length": 66.05, "max_line_length": 333, "alphanum_fraction": 0.785011355}
function People() {
  this.superstar = "Michael Jackson";
}
// Define "athlete" property on the People prototype so that "athlete" is accessible by all objects that use the People () constructor.
People.prototype.athlete = "Tiger Woods";

let famousPerson = new People();
famousPerson.superstar = "Steve Jobs";

// The search for superstar will first look for the superstar property on the famousPerson object, and since we defined it there, that is the property that will be used. Because we have overwritten the famousPerson’s superstar property with one directly on the famousPerson object, the search will NOT proceed up the prototype chain.
console.log(famousPerson.superstar); // Steve Jobs

// Note that in ECMAScript 5 you can set a property to read only, and in that case you cannot overwrite it as we just did.

// This will show the property from the famousPerson prototype (People.prototype), since the athlete property was not defined on the famousPerson object itself.
console.log(famousPerson.athlete); // Tiger Woods

// In this example, the search proceeds up the prototype chain and find the toString method on Object.prototype, from which the Fruit object inherited—all objects ultimately inherits from Object.prototype as we have noted before.
console.log(famousPerson.toString()); // [object Object]
