Object.defineProperty(fn, "name", { value: "New Name" });
Will do the trick and is the most performant solution. No eval either.
More Related Contents:
- Why is it necessary to set the prototype constructor?
- How is almost everything in Javascript an object?
- Preserving a reference to “this” in JavaScript prototype functions [duplicate]
- JavaScript: How to find out if the user browser is Chrome?
- Chrome sendrequest error: TypeError: Converting circular structure to JSON
- Chrome 65 blocks cross-origin . Client-side workaround to force download?
- Console.log showing only the updated version of the object printed
- Why is Proxy to a Map object in ES2015 not working
- JavaScript Time Zone is wrong for past Daylight Saving Time transition rules
- Can a site invoke a browser extension?
- How can a Chrome extension save many files to a user-specified directory?
- alias to chrome console.log
- Open Safari / Google Chrome developer tools programmatically from JavaScript
- Prevent Address-Bar hiding in mobile Browsers
- Event onBrowserClose for Google Chrome Extension?
- Add to browser favorites/bookmarks from JavaScript but for all browsers (mine doesn’t work in Chrome)?
- Object vs Class vs Function
- Defer Attribute (Chrome)
- Accessing Current Tab DOM Object from “popup.html”?
- Communicating between a Chrome packaged app and a Chrome extension?
- How to get list of network requests done by HTML
- Select a printer and silently print
- Chrome and IE sorts JSON Object automatically, how to disable this?
- How can I capture all network requests and full response data when loading a page in Chrome?
- How to window.open with a toolbar in Google Chrome?
- Chrome debugging – break on next click event
- Popstate on page’s load in Chrome
- Sorting an array of objects in Chrome
- How to develop Chrome extension for Gmail?
- How to to initialize keyboard event with given char/keycode in a Chrome extension?