Answer the question
In order to leave comments, you need to log in
"print" in Eloquent JavaScript by MARIGNE HAVERBECK?
1. How is it implemented?
2. To what extent is this methodologically correct? "print" on the client seems to cause printing to the printer.
Examples can be seen here eloquentjavascript.net/chapter3.html
Answer the question
In order to leave comments, you need to log in
Implemented like this:
win.print = function() {
var accum = [];
for (var i = 0; i != arguments.length; i++)
accum.push(String(arguments[i]));
var joined = accum.join("");
env.output(DIV(null, preNewline != "\n" ? joined.replace(/\n/g, preNewline) : joined));
};
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question