I am trying to set each item in an array into their own variables. Here is what the array looks like:
labels = ["label1", "label2", "label3", "label4", "label5"]
I have already created the variables:
let name1;
let name2;
let name3;
let name4;
let name5;
So I want to set each array item to each variable so that they look like this:
let name1 = "label1";
let name2 = "label2";
let name3 = "label3";
let name4 = "label4";
let name5 = "label5";
I am not really sure with how to proceed with this.
2
Answers
Is this what you want?
Here is one way to do it: