indexing - Get index value of array -
trying simple hitting brick wall. i'm trying index value of item in array, i'm using coffeescript not plain javascript.
code:
for in ["the royal family", "residences", "history & tradition", "news", "events", "jobs"] createsubmenulayer(i, i.value)
i've tried i.index, i.value, plain old (which gives me string). want index value position items based upon position in array.
cheers.
the for x in ...
form of for
loop iterates on values of array, not indexes. the documentation says:
# fine 5 course dining. courses = ['greens', 'caviar', 'truffles', 'roast', 'cake'] menu + 1, dish dish, in courses # -------------------^^^^^^^
so you're looking this:
for e, in [...] createsubmenulayer(i, e)
Comments
Post a Comment