Debug class constructor

72 views
Skip to first unread message

Bryan Chung

unread,
Sep 20, 2022, 9:40:54 AM9/20/22
to Google Apps Script Community
I wrote a new class. I would like to view the class properties while the constructor is running.

However, the apps script debugger does not show the object's properties until after the constructor finishes running. I put a breakpoint in the constructor, and the debugger shows the parameters passed in, but not object properties.

Is there any way for me to see the properties in the debugger while the constructor is running?

Here's a sample function:

class testClass {
  constructor (a) {
    this.x=a
    this.y=a^2
  }
}
function myFunction() {
  let myTestClass=new testClass(3)
  Logger.log(myTestClass)
}

If I put a breakpoint in the constructor, I cannot view x or y in the debugger.

Jim Willeke

unread,
Sep 23, 2022, 6:56:26 AM9/23/22
to Google Apps Script Community
Works for me:
Screen Shot 2022-09-23 at 06.55.25.png

Reply all
Reply to author
Forward
0 new messages