Enumerate not fully translating to JS?

Ok. So I set it to Code Type = “Both” and edited my code to java script as I understand it (which is next to nothing). This is the code I changed the python to, but it still displays a syntax error. I guess I’m kind of confused about how to edit python and JS in the same window.

function clickCount(clicked, box){
    #Return the list indices of a box
    for [i, x] of clicked.entries() {
    if (x == box){
    return i+1
    }
  }
}