I am setting the CSS of a div conditionally. For this I use a .filter. The filter compares 2 arrays.
When I run the code below, it does not work. When I hardcode the array\_1 content (taken from console; uncomment in code shown), then it does work. 

I assume that the array resulting from the loop is not ready for the filter function in time ?

```
  labelEnter.append("div")
  .attr("class", "bubble-label-name")
  .text((d) -> textValue(d))

  arraylocal = []
  typeofKey = null
  for key of localStorage
    typeofKey = (typeof localStorage[key])
    array = arraylocal.push key
    break
  console.log(array)

 # array = ["show", "cum", "nec", "show"]

  console.log(d3.selectAll(".bubble-label-name").filter((d) -> textValue(d) in array).style("border", "1px solid red"))

```

Why does the use of the hard coded array content work, but when I use the array variable, it does not ?