- In JS, each object has its prototype object, and it can use all the methods on its prototype object
- Obtain the prototype object method through the object
_proto_
, or get the prototype through the prototype attribute - Role: add methods to the prototype to achieve reuse, etc.
let data = new Date();
Date.prototype.formate = function(){
let year = this.getFullYear();
let month = this.getMonth()+1;
let date= this.getDate();
return `${
year}年${
month}月${
date}日`
}