We're logging javascript errors and one error message that has come up a lot is null is not an object, for example TypeError: null is not an object (evaluating 'foo[bar]'). In my searches about this error and trying to replicate the error, I continually get a Cannot read property 'foo' of null error instead. I cannot figure out a way to do something that results in a null is not an object error.
What is the difference between the two errors and what are some examples for when one would get called instead of the other?