What side effects does the keyword 'new' have in JavaScript?

前端 未结 6 2057
忘了有多久
忘了有多久 2021-02-07 01:58

I\'m working on a plug-in for jQuery and I\'m getting this JSLint error:

Problem at line 80 character 45: Do not use \'new\' for side effects.

(new jQuery.faste         


        
6条回答
  •  名媛妹妹
    2021-02-07 02:35

    Basically JavaScript tends to be a slow beast, so creating a new object just to call a function is quite inefficient. The function is static anyway.

    $.fasterTrim(this, options);
    

提交回复
热议问题