score:2

Accepted answer

That happens because the element on which you call .call is an object that doesn't have the call property (or it has it, but it's not a function).

How to fix, however, depends on what the issue really is.

However, these are my general suggestions to fix the issue:

  1. First, make sure you pinpoint the issue
    1. You are running in a loop, so make sure you know on which i your error occurs
    2. Try to break that chain of calls into separate statement, and console.log the element on which .call is not a function
  2. It is very likely that .call was intended as per Function.prototype.call implementation. This tells us the element which that .call is targeting should be function, so it narrows down what is the expected return value of the chain of calls.
  3. You put a lot of trust in the fact that this.points and each [i] is what you expect. I'd validate that bidimensional array a bit

More Query from same tag