Can you explain the disparity between the two results produced by this code snippet:
var animals = ["a", "b", "c", "d"];
console.log = [4];
console.log(animals.indexOf("e"));
Specifically, why does it display 'undefined' instead of '-1' for indexOf?