MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/javascript/comments/b2o6f2/whats_your_favorite_most_useful_javascript/eiutf1b/?context=3
r/javascript • u/Linux_is_awesome • Mar 18 '19
422 comments sorted by
View all comments
19
console.table(obj1); and console.log(JSON.stringify(obj1, null, 2); for debugging.
console.table(obj1);
console.log(JSON.stringify(obj1, null, 2);
3 u/thisguyfightsyourmom Mar 19 '19 I use console.log(JSON.stringify(yo, null, 2) when I need to copy paste objects out of the console—super quick way to get a pile of placeholder data 14 u/Oririner Mar 19 '19 just copy(yo) ;)(in Chrome DevTools) 2 u/thisguyfightsyourmom Mar 19 '19 You’re telling me I’ve learned what the second arg in console.log for nothing?!It’s nice for inspecting objects (readably) in test suites too—quick,… someone tell me the smarter way to do that too 2 u/Oririner Mar 19 '19 It sounds like you're not debugging the test suites in Chrome DevTools.you should do that instead ;) just add --inspect-brk when running the node process and follow the instructions. → More replies (1)
3
I use console.log(JSON.stringify(yo, null, 2) when I need to copy paste objects out of the console—super quick way to get a pile of placeholder data
console.log(JSON.stringify(yo, null, 2)
14 u/Oririner Mar 19 '19 just copy(yo) ;)(in Chrome DevTools) 2 u/thisguyfightsyourmom Mar 19 '19 You’re telling me I’ve learned what the second arg in console.log for nothing?!It’s nice for inspecting objects (readably) in test suites too—quick,… someone tell me the smarter way to do that too 2 u/Oririner Mar 19 '19 It sounds like you're not debugging the test suites in Chrome DevTools.you should do that instead ;) just add --inspect-brk when running the node process and follow the instructions. → More replies (1)
14
just copy(yo) ;)
copy(yo)
(in Chrome DevTools)
2 u/thisguyfightsyourmom Mar 19 '19 You’re telling me I’ve learned what the second arg in console.log for nothing?!It’s nice for inspecting objects (readably) in test suites too—quick,… someone tell me the smarter way to do that too 2 u/Oririner Mar 19 '19 It sounds like you're not debugging the test suites in Chrome DevTools.you should do that instead ;) just add --inspect-brk when running the node process and follow the instructions. → More replies (1)
2
You’re telling me I’ve learned what the second arg in console.log for nothing?!
It’s nice for inspecting objects (readably) in test suites too—quick,… someone tell me the smarter way to do that too
2 u/Oririner Mar 19 '19 It sounds like you're not debugging the test suites in Chrome DevTools.you should do that instead ;) just add --inspect-brk when running the node process and follow the instructions. → More replies (1)
It sounds like you're not debugging the test suites in Chrome DevTools.
you should do that instead ;) just add --inspect-brk when running the node process and follow the instructions.
--inspect-brk
→ More replies (1)
19
u/drboyfriend Mar 19 '19
console.table(obj1);andconsole.log(JSON.stringify(obj1, null, 2);for debugging.