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?
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
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 😄
Top comments (15)
Awesome tip, I never knew about
copy
before! In your example, you don't need to Store as global variable though — you could justcopy(bigObject)
directly.You're right! I've created
bigObject
so I could simulate something like:but I'm glad you caught that 😄
Nice tip, never heard of
copy
before!Good tip! My hack was this:
with Command C, V.
Very uncomfortable compared to
copy
methodGreat tip, but I think the gifs are a little bit too fast
Thanks for feedback, Marcell. I thought that would be the case...
I speed them up to decrease the overall frame count making each gif lighter, but I agree that it is looking a little intense 😬
I'll fix them and update the post, thanks!
Or just use Firefox, right click and 'Copy object'. Firefox's dev tools really are better than Chrome's IMO
A neat little trick that could come in handy at times 🔥👍
I'm stealing "neat little trick" for the name of this series, thanks 😄
I feel a lot of 🔥🔥🔥 coming in the future! 💯
Amazing ! Can you please share the tool used to generate the gif capture ?
Of course! I've used Kap for capturing it and Gif Brewery for optimizing it and making it faster 😄
Very useful! Thanks 👍🏾
Glad I could help!
Definitely It will reduce my frustration while I'm debugging the code 👌