Why do people call the jQuery $ alias a 'factory'?

前端 未结 2 692
不思量自难忘°
不思量自难忘° 2021-01-11 20:16

On various sites, jQuery\'s $ variable is referred to as an alias, and on others, it is referred to as a factory. I took a look at the source code, and I think

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-11 20:36

    I think either is an okay term. The dollar sign is certainly an alias for the jQuery function, specifically to be used as a shorthand. If someone refers to the function as a factory, I don't think that's specific to the $ alias, but just describing what the jQuery function does in general, which is create objects from various different types of input.

提交回复
热议问题