Array functions in jQuery

后端 未结 8 998
小鲜肉
小鲜肉 2020-12-13 08:55

I am using jQuery in my web application. I want to use arrays, but I am not able to find out functions for arrays (add, remove or append elements in array) in jQuery. Is the

8条回答
  •  一整个雨季
    2020-12-13 09:12

    Also there is a jQuery plugin that adds some methods on an array:

    Implementing Prototype’s Array Methods in jQuery

    This plugin implements Prototype's library array methods such as:

    var arr = [1,2,3,4,5,6];
    $.protify(arr, true);
    arr.all();  // true
    
    var arr = $.protify([1, 2, 3, 4, 5, 6]);
    arr.any(); // true
    

    And more.

提交回复
热议问题