I keep coming across JavaScript solutions that use the print() function as if it behaved like console.log(). (Random example here ).
I'm confused by this. In Firefox and Chrome, calling print() pops up a print dialog, and otherwise produces no output. In NodeJS, print is not defined.
So I don't really understand the basis for claiming that a program that uses print() behaves correctly.
The only place I can see that print() behaves like this is...in Try It Online, in either "JavaScript (V8)" or "JavaScript (SpiderMonkey)".
What am I missing? MDN says it's "newly available" in Baseline 2023, so did print() previously do something completely different from this?
I mean, I guess it's fine to say "my solution is written in TIO's specific dialect of JavaScript", just like any other language is acceptable, but perhaps it should be more specifically flagged as such.
printopens a print dialogue, in node.js it is undefined, and in spidermonkey / V8 it prints to the console. Each one of these is a different JavaScript implemenation, with its own advantages and disadvantages, and answers are free to use whichever they feel fit. Different implementations are considered different languages, and as such aren't considered to be competing with each other. \$\endgroup\$