Home > front end >  Put the prototype property in curly braces what is the difference between the inside and outside in
Put the prototype property in curly braces what is the difference between the inside and outside in

Time:02-21

Want to seek advice what is the difference between these two approaches, the results from a feedback as a result, one can't feedback, want to know the reason of those

Method one:
The function Person () {
}
Person. The prototype. The name='Jimmy';
Person. The prototype. The age=29;
='the Teacher' Person. The prototype. The job;
Person. The prototype. SayName=function () {
Alert (enclosing name);
}
Var keys=Object. Keys (Person. The prototype);
Alert (keys)

Method 2:
The function Person () {
Person. The prototype. The name='Jimmy';
Person. The prototype. The age=29;
='the Teacher' Person. The prototype. The job;
Person. The prototype. SayName=function () {
Alert (enclosing name);
}
}
Var keys=Object. Keys (Person. The prototype);
Alert (keys)
  • Related