Hacker News new | ask | show | jobs
by jneen 4565 days ago

    function makeRef(x) { return function() { return x; }; }
1 comments

This doesn't make the target object read-only - it just returns a reference to it.

  data = {one: "one"}
  ref = makeRef(data)
  ref().two = "two"
  
  data
  => Object {one: "one", two: "two"}