Skip to content

Instantly share code, notes, and snippets.

@cphoover
Last active February 8, 2021 23:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cphoover/fa5f9937d45792fdb82aad437cd332bf to your computer and use it in GitHub Desktop.
Save cphoover/fa5f9937d45792fdb82aad437cd332bf to your computer and use it in GitHub Desktop.
var locationURL = new URL('https://www.google.com/search?q=test')
var props = [];
for (var prop in locationURL) props.push(prop);
var locationObj = {};
props.forEach(prop => {
Object.defineProperty(locationObj, prop, {
get : () => locationURL[prop],
set : (val) => locationURL[prop] = val
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment