A function and an object at the same time?

后端 未结 2 1045
广开言路
广开言路 2021-02-14 01:36

Is it possible that after creating a function variable you can actually assign properties to it as if it\'s a regular object? This is what I did:

var example = f         


        
2条回答
  •  感情败类
    2021-02-14 02:22

    Functions are indeed objects in JavaScript. As any other object, they also have a prototype, that's where methods such as .call(), .apply() & .bind() come from.

提交回复
热议问题