I have a list of 3 lines that I need to separate into individual items efficiently.
myList = [MultiLine.attributes.renderers[0], MultiLine.attributes.renderers[1],
MultiLine.attributes.renderers[2]]
The desired output is:
line1 = MultiLine.attributes.renderers[0];
line2 = MultiLine.attributes.renderers[1];
line3 = MultiLine.attributes.renderers[2];
In Python, I would use the casting function for this task:
line + str(i) = MultiLine.attributes.renderers[i];
However, when attempting the equivalent in JavaScript, I receive a ReferenceError: invalid assignment left-hand side:
for(var j = 0; j < myList.length; j++){
"line" + String(j) = MultiLine.attributes.renderers[j];
}
Any suggestions on how to address this issue?
I am unsure about correctly updating variable values within the for-loop. Would using Break statements be beneficial?