JSFiddle - React, Tailwind, and code Playground
by yaero
JavaScript
class ApiClient {
constructor(name = 'aha') {
this.name = name;
}
showMe() {
console.log(this.name);
}
use(name) {
this.name = name;
}
}
const apiClient = new ApiClient();
var a = {
get apiClient() {
return new ApiClient('x');
}
}
console.log(a.apiClient.showMe());
console.log(apiClient.showMe());