r/javascript • • Dec 16 '18

Coming from Python to JS NSFW

const print = console.log

I found my safe space.

607 Upvotes

156 comments sorted by

View all comments

6

u/bart2019 Dec 17 '18

That nsfw tag, is that a joke?

0

u/[deleted] Dec 17 '18

[deleted]

3

u/bart2019 Dec 17 '18

I don't come from Python... So, "no".

But as this is for interactive debugging, I don't see ham in a shorthand. I'd even dare to use "p" or something equally short.

1

u/[deleted] Dec 17 '18

A non-exhaustive list of reasons this would be a bad idea in the workplace:

  1. These shenanigans will make your code illegible to other developers 1A) If you're only used to your own special syntax, it'll be harder for you to sight read other people's code.

  2. What if you decide you want to use 'p' for something else? Why reserve such a common letter (or word, in the case of 'print')?

  3. Most text editors will allow you to autocomplete to console.log in a keystroke or two anyway

Never assume that you're going to be the only person working with or reading your code, even in "personal projects." You never know when you're going to want to reuse that code, get help, or how projects might expand. Also there's no reason to accustom yourself to bad practices or syntax you'll never encounter in the workplace.