'Different `String` function behavior in Chromium and Safari

If you run the following code in the browser console, then you get different results in Chromium and Safari.

String(function() { <!--
}).length

Chromium returns:

19

Safari returns:

20

Why?

Note 1

Running via the StackOverflow code editor will deliver the same output, regardless of browser, probably due to the various levels of mediation between the raw output and the browser window.

Note 2

The toString outputs rendered into the console, differ:

Chromium:

'function() { \x3C!--\n}'

Safari:

"function () { <!--
}"

EDIT

This contains a correction of an earlier version of this question that presented incorrect interpretations of the result.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source