Defining a Global Variable from Library Object

52 views Asked by At

I seek to group GIDs and the SSID as properties of a "SheetIDs" object. The variables do not seem to be properly assigned when in the object. Could someone assist in finding the error? The library is ccCode.

ccCode Library:

const DashboardSSID = "TEMPSSID";
const DashboardSheetIDs = {SSID:"TEMPSSID"};

SpreadsheetCode:

//Working
//SpreadsheetCode
const DashboardSSID = ccCode.DashboardSSID;


//Not Working
//SpreadsheetCode
const DashboardSSID = ccCode.DashboardSheetIDs.SSID;
//SpreadsheetError
//TypeError: Cannot read properties of undefined (reading 'SSID')

The last one throws the error:

TypeError: Cannot read properties of undefined (reading 'SSID')

1

There are 1 answers

0
Adam of City Compost On

Thank you TheMaster for answering the question.

This is because const declarations aren't passed to end users as written in https://stackoverflow.com/a/60459759.


This was fixed by changing const to var.