Contributions
Re: instance of operator for different Checkpoint types
Hey Phil, Thanks for the replies. It makes sense now why instance of does not work since Regions and Tables are not native JScript objects and a constructor was never used to create them. Wrapping each object in a constructor is a creative work-around too. I ended up just ordering the objects in the array in a specific way so that they could be iterated over in groups. The code is a bit messier / longer and not that maintainable but gets the job done for now and is less work than calling that constructor for each Region / Table in the array. Below is how I defined an array of Region and Table objects (not checkpoints), assuming these objects have already been created in the Regions and Tables data stores of the project: var T3_CHECKS3 = [Regions.T3_Comm, Tables.T3_Sigs, Tables.T3_Sigs2, Regions.T3_Dialog1, Regions.T3_Dialog2]; I then do the checkpoints by making calls like T3_CHECK3[0].Check(ValidRegion) and T3_CHECKS[1].Check(). Michael1.2KViews0likes0Commentsinstance of operator for different Checkpoint types
Hello, I have an array of objects used in checkpoints and wanted to iterate over it and do different things based on the type of object (if it's a Table, do A, if it's a Region, do B). I am using JavaScript and I tried thecode below butI got an error saying Table is undefined. Is there another way to use the instance of operator to distinguish between Region objects and Table objects: for (i = 3; i < checks.length; i++) { if (checks instanceof Table) { ... A ... } else { ... B ... }Solved2.1KViews0likes3Comments