global variable in one file and writable from another

In the module1.jsw created one variable :
export let itemPrice = 0;

In the module2.jsw access and overwrite variable :
// import module1
import {multiply} from ‘backend/module1’;

// import variable from module1
import { itemPrice } from ‘select-components’;

function (event){
itemPrice = 100;
}

→ console.log show it is read-only variable how can change it to write-able

Hi,
please elaborate on what exact functionality you are trying to achieve including the following information:

  • Full code you use.

  • Where and when do you call console log including the code and the screenshot of what it shows when you run it.

  • Link to your editor.

  • Page where you use the code.

Hello, @science00000
Jsw files are executed on the server, and even if you overwrite the variable, you cannot be sure that next time you make a fetch call to the server, it will be exact same server where attribute was changed. So I suggest to store this dynamic data in collection.