Creating a jQuery like “$” object

前端 未结 8 1366
伪装坚强ぢ
伪装坚强ぢ 2020-12-08 03:25

My end goal is being able to do something like this:

MyVar(parameter).functionToPerform();

Silly enough, even after reading up on how varia

8条回答
  •  粉色の甜心
    2020-12-08 04:12

    when you do

    var test = new MyClass()
    

    you create an object that has two attributes move and print. You object test is no more a function because of the new statement. So calling test() is wrong.

提交回复
热议问题