When inspecting a JavaScript object, that uses getter/setter functions for properties (defined with Object.defineProperties) in the Firefox DevTools variables view, it shows the defined getter and setter functions for this particular property:
Is there any way to show the actual content instead of the functions in this view?
Edit: as nils commented, viewing the actual content means technically invoking the getter.
You can open the Firefox Developer Tools from the menu by selecting Tools > Web Developer > Web Developer Tools or use the keyboard shortcut Ctrl + Shift + I or F12 on Windows and Linux, or Cmd + Opt + I on macOS.
You can open the Browser Console in one of two ways: from the menu: select “Browser Console” from the Web Developer submenu in the Firefox Menu (or Tools menu if you display the menu bar or are on macOS). from the keyboard: press Ctrl + Shift + J (or Cmd + Shift + J on a Mac).
Getter returns the value (accessors), it returns the value of data type int, String, double, float, etc.
In JavaScript, accessor properties are methods that get or set the value of an object. For that, we use these two keywords: get - to define a getter method to get the property value. set - to define a setter method to set the property value.
Since Firefox 65 this is possible to invoke a getter via a button next to it within the logged object.
This was implemented in bug 820878 resp. issue 6140 on GitHub.
In versions prior to Firefox 65 you could output the getter's return value by simply calling it directly via the command line.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With