Re:Math.Round opens the browser print dialog
by camjohnson26 on Wednesday June 19, 2019 @07:21PM
(#20228323)
This happens because of scope chaining in JavaScript. If you call a function it will look for it in the current context. If it’s not there it will try to find it in the parent. If it’s not there it will keep checking the parent objects until it finds it, or throw an exception. Since window is the top level context and includes a print function, it gets called and shows the printer dialog.
[ Parent
| on HN ]