-
Possible to use letters as values? if (val2 == a)
Hello, I’m trying to work out if it’s possible to use letters as values for if conditions.
The idea is to use the layer name (2nd letter) to control it’s anchor point.
The below expression works if I replace a, b, c with numbers (1, 2, 3)..
I’m a bit dumbfounded to why this wont work – don’t understand the parseInt toString functions really!
lNme = thisLayer.name; //the name of the layer
val1 = lNme.substr(0, 1); // first letter
val2= lNme.substr(1, 1); // second letterif (val2 == a){[600, 600]}
else if (val2 == b ){[300, 300]}
else if (val2 == c ){[100, 100]}
else{value}