How would one go about creating a javascript object (not literal) in LWC? i understand the standard syntax of something like
function bar(dog, cat) {
this.dog = dog;
this.cat = car;
this.getdetails = function() {
return this.dog + this.cat}
}
how could this be executed in the lwc javascript file?
i've tried something like this:
Bike() {
function blah(tet,sarah) {
this.tet = tet;
this.sarah = sarah
}
}
However its scoping the tet and sarah variables to the overall class, not the function blah. Am i missing something obvious here? (could be the case)
Best Answer
Sample code, creating a class outside of the lightning elements class is the easiest way