May 2, 2024, 5:11 p.m. | Simon Mei

DEV Community dev.to




Security and flexibility with getters and setters


In JavaScript, there are two kinds of object properties:



  1. Data properties:



let myObj = {name: "Joseph", surname: "Joestar"}
// name and surname are data properties

myObj.name // Joseph



  1. Accessor properties



let myObj = {
get name() {
return this._name;
},
set name(value) {
this._name = value;
},
get surname() {
return this._surname;
},
set surname(value) {
this._surname = value;
},
get fullName() {
return `${this._name} ${this._surname}`
}
}
// properties starting with an …

beginners data flexibility javascript name object return security value webdev

Information Security Engineers

@ D. E. Shaw Research | New York City

Technology Security Analyst

@ Halton Region | Oakville, Ontario, Canada

Senior Cyber Security Analyst

@ Valley Water | San Jose, CA

Security Operations Manager-West Coast

@ The Walt Disney Company | USA - CA - 2500 Broadway Street

Vulnerability Analyst - Remote (WFH)

@ Cognitive Medical Systems | Phoenix, AZ, US | Oak Ridge, TN, US | Austin, TX, US | Oregon, US | Austin, TX, US

Senior Mainframe Security Administrator

@ Danske Bank | Copenhagen V, Denmark