Using alert() for debugging. This is almost always worse than using console.log(). Everything passed to alert is converted to a string, which is why you see "[object Object]" instead of something useful. Switch to console.log() and you'll see something meaningful.