1

I'm trying to copy to my clipboard a value I saved as a global variable in Chrome's console. If I try to copy the saved global, or JSON.stringify it, I only get the first property isTrusted.

enter image description here

Dylan Landry
  • 1,150
  • 11
  • 27
  • 1
    get all properties from MouseEvent and copy your own object – AlexOwl Mar 12 '19 at 13:50
  • Same happens in Safari – Ardesco Mar 12 '19 at 13:52
  • Apparently the object logged in the console isn't the actual object -> https://stackoverflow.com/questions/17546953/cant-access-object-property-even-though-it-exists-returns-undefined – Dylan Landry Mar 12 '19 at 13:53
  • 1
    As noted in the first comment you need to make a copy yourself or by using a js library, more info: [How to stringify event object?](//stackoverflow.com/q/11547672) – wOxxOm Mar 12 '19 at 13:55
  • I think the other properties are omitted because they are read-only. AFAIK this is standard behavior. You can test this behavior: `var obj = {x:5}; Object.defineProperty(obj, "prop", { value: "test" }); JSON.stringify(obj);` –  Mar 12 '19 at 13:59

0 Answers0