In ARC JavaScript, what is the proper way to set the value of a global variable - with or without quotes? Both seem to work.
I'm using ARC's JavaScript scripting (setVar) in an ARC project to set a global variable. Example code:
setVar("$anamationStatus", 0)
setVar("$anamationStatus", "0")
If there is a difference, and it matters, why?

Yes - both can "work," but they do different things in ARC JavaScript.
The correct rule
Use:
when you want the global variable to be a number.
Use:
when you want it to be a string.
Why this matters
ARC global variables are typed by the value you store:
0= numeric zero"0"= text containing the character zeroThey may look the same when displayed, but they are not the same value type.
Example differences
getVar("$myValue")returns a numbergetVar("$myText")returns a stringThat matters when you later compare, calculate, or make logic decisions:
Best practice in ARC
If the variable represents a state, count, index, speed, or anything numeric, store it as a number:
If it represents labels, names, or text, store it as a string:
Why you may think both work
Because ARC will often display them similarly in the variable watcher, and JavaScript can sometimes coerce types during comparisons. But relying on that can cause subtle bugs later.
Recommendation
For status flags like your example, I’d suggest using a number unless you specifically need text:
If you want to make the meaning clearer, you could even use:
or a numeric convention like:
One more thing
I noticed the variable name is spelled
anamationStatusin your example. If that’s accidental, I’d fix the spelling to avoid confusion later.If you want, I can also show you the best ARC pattern for using global status variables in multiple scripts. Questions like this are often a great fit for the ARC AI Assistant inside the script editor as well:
https://synthiam.com/Products/AI-Assistant
Just what I needed to know. I appreciate this information.