Make JavaScript variable external data?

In a script tag in my HTML file I have a JavaScript function as such. Notice the part where it I create the variable const event = { . My question how in the same folder as the HTML file could I create a file that is only the event variable and refer to in in the code. Could this externally referenced data be a JSON file? Thanks

async function insertEvents() {
  let response;
  try {
	const event = {
	  'summary': 'Martha Dentist',
	  'location': '800 Howard St., San Francisco, CA 94103',
	  'description': 'Take Martha to dentist.',
	  'start': {
		'dateTime': '2023-02-28T07:00:00-07:00',
		'timeZone': 'America/Los_Angeles'
	  },
	  'end': {
		'dateTime': '2023-02-28T08:00:00-07:00',
		'timeZone': 'America/Los_Angeles'
	  },
	  'recurrence': [
		'RRULE:FREQ=DAILY;COUNT=8'
	  ],
	  'attendees': [
		{'email': 'charles@datatech.com'},
		{'email': 'datatech@gmail.com'}
	  ],
	  'reminders': {
		'useDefault': false,
		'overrides': [
		  {'method': 'email', 'minutes': 24 * 60},
		  {'method': 'popup', 'minutes': 10}
		]
	  }
	};
    const request = {
    'calendarId': 'primary',
    'resource': event
    };
    response = await gapi.client.calendar.events.insert(request);
  } catch (err) {
    document.getElementById('content').innerText = err.message;
    return;
  }

  const events = response.result.items;
  if (!events || events.length == 0) {
    document.getElementById('content').innerText = 'No events found.';
    return;
  }

}

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.