The simplest way is to put the variables in a file and export them. In order to use global variables, you can use an import statement.

'use strict';

export const name='bestinterviewquestion.com';

After that, we can export this file where we want to use these global variables value.
import * as myGlobalsFile from './globalfile';

BY Best Interview Question ON 24 Jun 2020