Mutable variable is accessible from closure. How can I fix this?

前端 未结 5 1918
没有蜡笔的小新
没有蜡笔的小新 2020-12-12 12:17

I am using Typeahead by twitter. I am running into this warning from Intellij. This is causing the \"window.location.href\" for each link to be the last item in my list of i

5条回答
  •  孤城傲影
    2020-12-12 12:35

    Since the only scoping that JavaScript has is function scope, you can simply move the closure to an external function, outside of the scope you're in.

提交回复
热议问题