Answers for "setter methods"

-1

getter and setter in javascript

const person = {
    name: "abc",
  
    get Name() {
      return this.name;
    },
  
    set Name(v) {
      this.name = v;
    }
  };
  
 console.log(person.Name); 
 person.Name = 'John Doe'; 
 console.log(person.Name);
Posted by: Guest on August-17-2021

Python Answers by Framework

Browse Popular Code Answers by Language