Escape string in eval context with JSON.stringify
问题 First of all: I know that there are many questions related to escaping, but I did not found a generally working answer so far. Say I have this simple toy function for demonstration: function f(somePOJO) { var s = eval("'" + JSON.stringify(somePOJO) + "';"); // for demonstration only return JSON.parse(s); } const clone = f({a: 1, b: "c"}); Given an object literal such as {a: 1, b: "c"} (a POJO), f should return a "clone" of it. (Note that I do not really use this approach for cloning or