I’m coming from a background of Java and haven’t used classes in Javascript before, so I’m not really sure what is wrong with my code, but probably something quite obvious in hindsight.
When I go to preview mode to test the code it comes up with an error of " TypeError: firstService.setAddress is not a function "
services.js
import wixData from 'wix-data';
export class service {
set setId(id) {
this.Id = id;
}
get getId () {
return this.Id;
}
set setAddress(txtAddress) {
this.address = txtAddress;
}
get getAddress () {
return this.address;
}
set setDate(date) {
this.dateOfInstall = date;
}
get getDate() {
return this.date;
}
set setNotes(note) {
this.noteOnVisit = note;
}
get getNotes() {
return this.noteOnVisit;
}
}
the code where it’s being used:
let firstService = new service(address + "-" + date.toLocaleDateString());
firstService.setAddress(address);
firstService.setDate(date);
firstService.setNotes(notes);
Thanks for any help given!