The most fundamental cause of this error is when Javascript encounters a statement attempting to read a property through an array index that doesn't exist, eg 'someArray[0].someProperty' would throw such an error if nothing exits at array index 0 of 'someArray'.
A very typical situation in which this arises is when a function is called that normally returns an array and the code assumes the 0 index exists; this often happens in jQuery calls where so many of those selector-type functions return an array of values, and the expectation/assumption is that the desired action is to be taken against the first element (index 0).