How to Copy a Big Object or Array From Console to Clipboard

This article was originally published in the DEV Community.

Have you ever found yourself trying to Ctrl-C a console.log() output, only to get mad when it doesn't really work with long Objects and Arrays?

Gif showing a failed attempt to copy a big object

Here's what you should do instead: #

1 - Right-click the console.log() output
2 - Click "Store as global variable"
3 - Run copy(temp1)
4 - Ctrl-V it wherever you want

Gif showing how to copy a long object

Success! You may find that useful when debugging complex data structures or request payloads.

Let me know in the comments what else copy() might be useful for! 😄

Cover photo by Paolo Nicolello on Unsplash

Why the cover photo is a monkey? Well, I make the same face when I'm debugging.

Hey, let's connect 👋 #

Follow me on Twitter and let me know you liked this article!

And if you really liked it, make sure to share it with your friends, that'll help me a lot 😄