[Javascript] Array functions in jQuery


Answers

jQuery has very limited array functions since JavaScript has most of them itself. But here are the ones they have: Utilities - jQuery API.

Question

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 there any link related to jQuery array functions which will explain the jQuery array functions?







The Visual jQuery site has some great examples of jQuery's array functionality. (Click "Utilities" on the left-hand tab, and then "Array and Object operations".)




You can use underscore.js. It really makes things simple.

For example removing elements from array you need to do -

_.without([1,2,3], 2);

and the result will be [1,3].

It reduces the code that you write using grep etc in jquery.




Links