javascript functions are objects?

后端 未结 8 2106
太阳男子
太阳男子 2020-12-14 23:10

I am struggling with a Javascript question for some time now and I was not able to find an explanation on the web. I guess it is because I do not enter the right keywords wh

8条回答
  •  温柔的废话
    2020-12-14 23:49

    Object properties and local variables are largely unrelated:

    • var n declares a variable that is scoped to the function it's in (i.e. it is not visible outside of that function (except via closure)).

    • addn['n'] adds a property named n to addn and is equivalent to addn.n

提交回复
热议问题