Hi!
When I declare:
var myVariable = myVariable.split(".")[0]
In a widget's colorFill field, it breaks. I can't figure it out.
Any help would be much appreciated!
Hi!
When I declare:
var myVariable = myVariable.split(".")[0]
In a widget's colorFill field, it breaks. I can't figure it out.
Any help would be much appreciated!
Can you post the full content of the colorFill
property ?
Sure thing, it's:
JS{{
var qlab_num = @{cueNumber.value}
var gp_num = @{gp_song_index.value}
var qlab_split = qlab_num.split(".")[0]
if (gp_num === qlab_split) {
return "green"
} else {
return "yellow"
}
}}
Are you confident qlab_num
is a string ? You could write this to avoid errors in case it's not:
String(qlab_num).split(".")[0]
That did it. I actually had to convert both variables to a string before comparing them, and it works! Thank you for getting back so quickly.
Yes, ===
is strict regarding types:
"1" == 1 // true
"1" === 1 // false