The same way one would when returning an anonymous map in JavaScript - via reflection and the assumption of what was returned.
While JavaScript makes the use of reflection less burdensome, it has the same collaboration fragility as a Java version. Just with less ceremony.