r/javascript • • Mar 18 '19

What's your favorite, most useful javascript one-liner?

385 Upvotes

422 comments sorted by

View all comments

Show parent comments

35

u/senocular Mar 18 '19

Haven't you heard? You don't need JavaScript for that anymore ;)

https://www.youtube.com/watch?v=uddZX9ZK6wY&t=31

6

u/ReaderSeventy2 Mar 18 '19

I had not. Thanks.

8

u/KinkyCode Mar 19 '19

That seems awfuly cumbersome when you may as well just log stuff as you build it...

0

u/catwhatcat Mar 19 '19

For compiled code (from Angular, TS, etc.) it can save time and you generally don't want logs in your code unless it's thru some kind of service that obfuscates their location.

3

u/duGarbandier Mar 19 '19

It's very cool, but I still prefer console.log I think, since they can be commented out and uncommented at any point later during development. Generally a production build will automatically strip out logging won't it?

2

u/KinkyCode Mar 19 '19

I see. That does make sense.

2

u/[deleted] Mar 19 '19

Have you used FireFox Developer Edition ?? They have this functionality. Also some cool other fun things ..Take the tutorial.

1

u/pookage Senior Front-End Mar 19 '19

I hadn't seen this! Amazing!

1

u/FormerGameDev Mar 25 '19

VS Code has had this for a really long time now too. However, it generally doesn't seem to work. I suspect same in Chrome, as they are probably implemented exactly the same way.