What is meant by 'first class object'?

后端 未结 11 1584
生来不讨喜
生来不讨喜 2020-11-22 10:46

In a recent question, I received suggestions to talk on, amongst other things, the aspect of JavaScript where functions are \'first class\' objects. What does the \'first c

11条回答
  •  佛祖请我去吃肉
    2020-11-22 11:15

    It means that function actually inherits from Object. So that you can pass it around and work with it like with any other object.

    In c# however you need to refrain to delegates or reflection to play around with functions. (this got much better recently with lambda expressions)

提交回复
热议问题