MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/javascript/comments/a6txtp/coming_from_python_to_js/ebzx4qr/?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
84
you need to use bind so the log function keeps the context of console.
const print = console.log.bind(console)
0 u/[deleted] Dec 17 '18 [deleted] 1 u/saadq_ Dec 17 '18 A method is a function though
0
[deleted]
1 u/saadq_ Dec 17 '18 A method is a function though
1
A method is a function though
84
u/uberpwnzorz Dec 17 '18
you need to use bind so the log function keeps the context of console.
const print = console.log.bind(console)