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

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -