this.MyMenu = function(){
this.MyMenu = function(){
for(i = 0; i < vis.Labels.length; i++)
{
text(vis.Labels[i].name, 100, 50 * i+80);
}
};
I have written a for loop that iterates over the array stored in the Labels property of the vis object, which itself is kept in the global vis variable defined in sketch.js, writing each Labels property to the screen. Mymenu is displayed when I press the space bar and it looks as follows:
Select a Library:
Washington
Moscow
Beijing
I would like, however, that a number of the array was also displayed in the following manner, e.g.
1: Washington
2: Moscow
3: Beijing
I was trying to use IndexOf +1 but with no luck so far. Do you have any tips on how this could be achieved?
Thanks in advance Andy
i+1should do.