Java script debugging

I am running into a buzz saw with java script.

I have a long piece of code where I have a variable called “mCONTINUE” can change from “NO” to “YES” according to things happening with the code.

I have to use code like

mCONTINUE = table2.data[0].Continue2;

To update the value.

Java script sometimes likes

Let mCONTINUE = table2.data[0].Continue2;

and other times it likes

mCONTINUE = table2.data[0].Continue2;

The Retool editor does not pick up on this. But the debugger says “invalid left hand side in assignment”. There is no line number and I have 100 lines.

Is there a recommended editor that can figure this type of thing out?

Mike

Hi @mdsmith1,

The key words let is used to create a variable, such as mCONTINUE. So every time you use let and the same variable name it is re-creating a new variable instead of changing an existing variable.

Once a variable is created, it can have its value changed with a statement such as mCONTINUE = table2.data[0].Continue2;

If a variable has not yet been created with let then it cannot be referenced and re-asigned with only a = sign.

Have you tried copy and pasting the 100 lines of code and the error message into ChatGPT to see if that tool is able to better identify why you are getting the error message? I would need to see your code to better help pinpoint the issue.

Also check out these docs here to better understand that error message.

As it seems that error occurs when the editor is expecting that when you are not using let that you are trying to compare values using a == or === for comparison instead of a single = for assignment.