MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/javascript/comments/a6txtp/coming_from_python_to_js/eby14h9/?context=3
r/javascript • u/chroner • Dec 16 '18
const print = console.log
I found my safe space.
156 comments sorted by
View all comments
14
This won't work. Or at least, it didn't used to work. I haven't tried it in a very long time.
You'd need to do print = console.log.bind(console).
print = console.log.bind(console)
16 u/konaraddio Dec 16 '18 It worksI think you only need the .bind if console.log were to use this in its implementation 2 u/imguralbumbot Dec 17 '18 Hi, I'm a bot for linking direct images of albums with only 1 imagehttps://i.imgur.com/YMlhou8.pngSource | Why? | Creator | ignoreme | deletthis
16
It works
I think you only need the .bind if console.log were to use this in its implementation
.bind
console.log
this
2 u/imguralbumbot Dec 17 '18 Hi, I'm a bot for linking direct images of albums with only 1 imagehttps://i.imgur.com/YMlhou8.pngSource | Why? | Creator | ignoreme | deletthis
2
Hi, I'm a bot for linking direct images of albums with only 1 image
https://i.imgur.com/YMlhou8.png
Source | Why? | Creator | ignoreme | deletthis
14
u/Asmor Dec 16 '18
This won't work. Or at least, it didn't used to work. I haven't tried it in a very long time.
You'd need to do
print = console.log.bind(console).