MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/javascript/comments/a6txtp/coming_from_python_to_js/ebz7o65/?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)
10 u/LiverReich Dec 17 '18 This comment needs a lot more appreciation 5 u/username_is_taken43 Dec 17 '18 Yeah, don't hide the beauty of Javascript
10
This comment needs a lot more appreciation
5 u/username_is_taken43 Dec 17 '18 Yeah, don't hide the beauty of Javascript
5
Yeah, don't hide the beauty of Javascript
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)