What does that js code means?
this.totals || (this.totals={});
i suppose..
if(!this.totals) {
this.totals = {}
}
is this correct?
You are almost 100% correct. When || is encountered the first part is evaluated and if it's a truthy value it is returned. If it's a falsey value the second part is evaluated which in this case sets this.totals to {} and returns the evaluation, {}.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With