pub fn debug_display(interp: &Interp<'_>, value: &Value) -> StringExpand description
How print renders a value: the reference’s JS_PrintValue.
This is not ToString. print({a:1}) shows { a: 1 } and print([1]) shows
[ 1 ], because the host printer dumps the structure rather than converting it.
The format is reproduced closely because the test suite compares output text:
- an empty container has two spaces inside its brackets —
[ ],{ }; - nesting stops at depth 2 and prints
[Array]/[Object]; - a cycle prints
[circular N]withNthe stack index of the object; - an array with an interior hole prints as
idx: valuepairs, while holes at the end print as<N empty item(s)>; - a string is quoted inside a container but raw at the top level, which is why
print("x")andprint(["x"])differ.