Home javascript I get Maximum Call Stack Size Exceeded

I get Maximum Call Stack Size Exceeded

Author

Date

Category

Code itself:

var person = {
  Name: "nikita",
  Age: 18,
  GENDER: "MALE"
}
Object.DefineProperty (Person, 'Age', {
  Get: Function () {
    Return this.age;
  },
  SET: FUNCTION (NAGE) {
    RETURN THIS.AGE = NAGE;
  }
});
Console.log (Person.age)
person.age = 19;
Console.log (Person.age)

Answer 1, Authority 100%

@grommash the hellscream properties functions should not operate the property itself otherwise the infinite Recursion Object.DefineProperty (Person, age ', {change the name here or use only Value instead of SET and GET, which is a special meaning Does not, it is already important or in the SET and GET themselves do not use this.age

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions