79444495

Date: 2025-02-17 05:47:45
Score: 2
Natty:
Report link

A normal function (function(img) {}) creates its own this, so this.canvas is undefined. And arrow functions ((img) => {}) don’t have their own this, they use this from the surrounding code. Switch to an arrow function, it will fix the problem, also, if you use use this.canvas?.add(img1) you'll avoid errors if canvas is not set yet.

Reasons:
  • No code block (0.5):
  • Contains question mark (0.5):
  • Single line (0.5):
  • Low reputation (0.5):
Posted by: MJepbarov