Can anyone tell me how I make a set of an MVC Javascript class? I submit, but whenever I redeem the value to check it gets undefined. Here's an example:
charController.js :
class CharController {
constructor() {
this._charNameSelected;
this.initialize();
}
get charNameSelected() {
return this._charNameSelected;
}
set charNameSelected(value) {
this._charNameSelected = value;
}
initialize() {
console.log(this.charNameSelected);
}
}
charModel.js :
objCharController = new CharController();
objCharController.charNameSelected = "teste";