Search code examples
javascriptcssdevtools

Weird console.log behavior in Chrome dev tools?


In Chrome Dev Tools, you console.log an Array. It shows: (4)[Location, Location, Location, Location]: perfect, that's what I expected.

You click on it, to reveal the elements, and it shows:

screenshot

How is this possible?


Solution

  • This happens when the element is edited after it was logged. Chrome just shows you a pointer to that element. If 2 and 3 are removed after console.log() they are shown in the preview, but not when you inspect the element.