JavaScript Object Getter and Setter Methods
Getter
Getter methods are used to return an object's properties.
See the examples below:
const person = {
name: 'Bello',
age: 27,
getPerson() {
if (typeof this.name === 'string' && typeof this.age === 'number') {
return `${this.name}...
techstack.hashnode.dev2 min read