MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/javascript/comments/a6txtp/coming_from_python_to_js/ec0i536/?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] 2 u/uberpwnzorz Dec 18 '18 it's a prototype function, technically. MDN calls it a function https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/prototypeClasses and Methods are just sugar for prototype in JavaScript
0
[deleted]
2 u/uberpwnzorz Dec 18 '18 it's a prototype function, technically. MDN calls it a function https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/prototypeClasses and Methods are just sugar for prototype in JavaScript
2
it's a prototype function, technically. MDN calls it a function https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/prototype
Classes and Methods are just sugar for prototype in 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)