I want be able to export and then modify a object. However I am not sure if this is unexpected behavior.
test.js:
// Short syntax
export const foo = [];
foo[0] = 1;
// Long syntax
const bar = [];
bar[0] = 1;
export { bar };
index.js:
import { foo, bar } from "./test.js";
console.log("foo:" + foo); // Is it guaranteed to be [1]? Or can it be []?
console.log("bar:" + bar); // I always expect this to be [1].
This might be a foolish example but sometimes I have an object and want to register some methods/properties. I want to know if I am able to export it and then register them.