view contents of large array?
I have a very large array I need to check for debugging purposes, problem is it crashes firebug an开发者_如何学Cd the like if I try to view the data.
Is there a way I can dump the array to a text file or something?
Why not just dump it on the document itself? If you are using Firefox, try the following:
document.write(myBigArray.toSource());
Then copy paste like your usually do on normal website.
p/s: toSource()
requires browser that supports Javascript 1.3 and above
Opera has scrollable alerts, it's very useful for developing.
EDIT: Tested with success for messages with 500000 lines. You can also copy from it.
Post the array to the server (json/hidden field normal form post), and use your server-side language to save that array dump to a file.
If you are using IE you could try copying a string representation of the array to the clipboard.
There are some libraries that can help in writing to files. You can use ActiveX, but that binds you to internet explorer for your debugging and that's kind of outside the javascript world.
精彩评论