Module assignment of nodejs, global variable

how nodejs permanently changes the properties in the module is similar to reference passing.
A js file require is assigned to change the property, and other js require is directly followed by the new value.
what you really want is a global variable, but you can change it at any time, and other file references are changed values after the change

Jan.19,2022

New global.js


class Foo {
  constructor ({name, age} = {name: 'foo', age: 0}) {
    this.name = name
    this.age = age
  }
}

module.exports = new Foo()

if you change the value in any file, the values in name, and age, will change

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3bd53-4d963.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3bd53-4d963.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?