Issue
Is there a way in one of the browsers to just copy the output of console.log? When mocking an object for Angular unit tests, I output a real data set with console.log(myObject)
and would like to be able to just get the object on my clipboard to paste it into my unit test. I saw an answer on how to print out to a file in chrome, but that's probably overkill for me at this point.
Solution
Most of the time, you can just copy it. That won't always work for large, complex objects. You can also use JSON.stringify
to force string output:
var foo = {"bar":"baz"};
console.log(JSON.stringify(foo));
Answered By - elixenide
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.