Is this for debugging, or something else?
If it is for debugging, alert() is a really bad
idea. Use console.log().
alert()
blocks the UI, and can cause some unwanted side-effects, ESPECIALLY
when debugging. It can break code that works, and make code that
does't work - work!
If it is NOT for debugging, I still wouldn't use alert(). There are nice
popup plugins for this. Evil, blocking-UI alert() isn't much
better for users than it is for developers who are debugging.
And this looks like it might produce some considerable number of
lines. (I don't know how long your list is.) Nothing worse than a
huge alert that is so big that you can't hit the close button.