JSFiddle - React, Tailwind, and code Playground
by Arnaud Buchholz
JavaScript
class Token {
#firstName;
#lastName;
constructor (firstName, lastName) {
this.#firstName = firstName;
this.#lastName = lastName;
this.blah = 'blah';
}
get firstName () { return this.#firstName; }
get lastName () { return this.#lastName; }
}
const token = new Token('arnaud', 'buchholz');
console.log(JSON.stringify({
...token,
firstName: token.firstName,
lastName: token.lastName
}));
console.log('firstName' in token);
console.log(Object.hasOwnProperty('firstName'));