Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If `thing` contains any cycles then it will explode. E.g.

    const thing = {};
    thing.self = thing;
or

    const thing = [];
    thing.push(thing);
If this sounds far-fetched to you just know that all DOM elements have these circular references through (for example) parent / child references.

Also any non-enumerable properties that may have been defined on objects are lost.

Basically the function is only suitable for recently parsed JSON.



That's a great point




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: