MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/javascript/comments/a6txtp/coming_from_python_to_js/eby1xsf/?context=9999
r/javascript • u/chroner • Dec 16 '18
const print = console.log
I found my safe space.
156 comments sorted by
View all comments
22
I actually kind of like this because I always manage a typo when I type 'console.log'. I get a lot of 'cosnole.log'. I think I'm much more consistent typing 'print'.
26 u/Earhacker Dec 16 '18 VS Code, Atom and the like usually have a snippet that autocompletes when you just type "log". 0 u/[deleted] Dec 16 '18 [deleted] 33 u/Earhacker Dec 16 '18 You could go to Menu -> Preferences -> User Snippets -> JavaScript and add this to the file:"Print to console": { "prefix": "print", "body": [ "console.log('$1');", "$2" ], "description": "Log output to console" }And now every time you type "print" in a JS file it will autocomplete to "console.log()" with your cursor between the brackets.Safe space safely restored! 0 u/[deleted] Dec 16 '18 [deleted] 16 u/Earhacker Dec 17 '18 for loops are for dirty Python casuals. Over here in JavaScript we use Array.prototype.forEach.(but sure, we use your fornum loop sometimes too) 0 u/[deleted] Dec 17 '18 [deleted] 8 u/Earhacker Dec 17 '18 You monster.
26
VS Code, Atom and the like usually have a snippet that autocompletes when you just type "log".
0 u/[deleted] Dec 16 '18 [deleted] 33 u/Earhacker Dec 16 '18 You could go to Menu -> Preferences -> User Snippets -> JavaScript and add this to the file:"Print to console": { "prefix": "print", "body": [ "console.log('$1');", "$2" ], "description": "Log output to console" }And now every time you type "print" in a JS file it will autocomplete to "console.log()" with your cursor between the brackets.Safe space safely restored! 0 u/[deleted] Dec 16 '18 [deleted] 16 u/Earhacker Dec 17 '18 for loops are for dirty Python casuals. Over here in JavaScript we use Array.prototype.forEach.(but sure, we use your fornum loop sometimes too) 0 u/[deleted] Dec 17 '18 [deleted] 8 u/Earhacker Dec 17 '18 You monster.
0
[deleted]
33 u/Earhacker Dec 16 '18 You could go to Menu -> Preferences -> User Snippets -> JavaScript and add this to the file:"Print to console": { "prefix": "print", "body": [ "console.log('$1');", "$2" ], "description": "Log output to console" }And now every time you type "print" in a JS file it will autocomplete to "console.log()" with your cursor between the brackets.Safe space safely restored! 0 u/[deleted] Dec 16 '18 [deleted] 16 u/Earhacker Dec 17 '18 for loops are for dirty Python casuals. Over here in JavaScript we use Array.prototype.forEach.(but sure, we use your fornum loop sometimes too) 0 u/[deleted] Dec 17 '18 [deleted] 8 u/Earhacker Dec 17 '18 You monster.
33
You could go to Menu -> Preferences -> User Snippets -> JavaScript and add this to the file:
"Print to console": { "prefix": "print", "body": [ "console.log('$1');", "$2" ], "description": "Log output to console" }
And now every time you type "print" in a JS file it will autocomplete to "console.log()" with your cursor between the brackets.
Safe space safely restored!
0 u/[deleted] Dec 16 '18 [deleted] 16 u/Earhacker Dec 17 '18 for loops are for dirty Python casuals. Over here in JavaScript we use Array.prototype.forEach.(but sure, we use your fornum loop sometimes too) 0 u/[deleted] Dec 17 '18 [deleted] 8 u/Earhacker Dec 17 '18 You monster.
16 u/Earhacker Dec 17 '18 for loops are for dirty Python casuals. Over here in JavaScript we use Array.prototype.forEach.(but sure, we use your fornum loop sometimes too) 0 u/[deleted] Dec 17 '18 [deleted] 8 u/Earhacker Dec 17 '18 You monster.
16
for loops are for dirty Python casuals. Over here in JavaScript we use Array.prototype.forEach.
for
(but sure, we use your fornum loop sometimes too)
fornum
0 u/[deleted] Dec 17 '18 [deleted] 8 u/Earhacker Dec 17 '18 You monster.
8 u/Earhacker Dec 17 '18 You monster.
8
You monster.
22
u/BloodAndTsundere Dec 16 '18
I actually kind of like this because I always manage a typo when I type 'console.log'. I get a lot of 'cosnole.log'. I think I'm much more consistent typing 'print'.