jQuery.each implementation differs from native Array.forEach

前端 未结 3 1989
星月不相逢
星月不相逢 2020-12-09 09:11

Does anyone why is the otherwise excellent jQuery.each function is designed differently from the (now) native Array.forEach? F.ex:

         


        
3条回答
  •  我在风中等你
    2020-12-09 10:02

    Well i agree it makes more sense to have the key second but you have to keep in mind $.each can be used with an object or an array and in the case of the object you may want the keys since they have meaning.

提交回复
热议问题