I am making a demo page with retool.
I am new to JS, so I might not understand the nature of JS yet.
I try to set a value to a localStorage variable.
eg) localStorage.setValue("a", "yes")
then, I try to use the set value, in one of the following lines.
I found the localStorage "a" is not set until the JS script ends.
It happens also with updating textArea value as below
var dialog = textArea_dialog.value var backlog = textArea_backlog.value dialog += "\n"+user_input_line backlog += "\n"+user_input_line textArea_dialog.setValue(dialog) //the value is not changed. I checked it with console log. textArea_backlog.setValue(backlog) //the value is not changed. I checked it with console log.
Is there any way to save something to a global variable and use it in the same JS script?