Assign-object vs JSON Stringify

Edit on GitHub

Setup

Tests

  • Assign-object

    var g = {hi: 42};
    var f = Object.assign({}, g);
  • JSON Stringify

    var g = {hi: 42};
    var f = JSON.parse(JSON.stringify(g))