Array functions in jQuery

I am using jQuery in my web application. I want to use arrays, but I cannot find functions for arrays (add, delete or add elements in an array) in jQuery. Is there a connection related to jQuery array functions that will explain jQuery array functions?

+44
javascript function jquery arrays
Jan 25 '09 at 13:45
source share
8 answers

Take a look at https://developer.mozilla.org/En/Core_JavaScript_1.5_Reference/Global_Objects/Array for documentation on JavaScript arrays.
jQuery is a library that adds some magic to JavaScript, which is a powerful and functional scripting language. Libraries just fill in the blanks - find out the core!

+83
Jan 25 '09 at 2:00
source share

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

+24
Jan 25 '09 at 13:50
source share

A simple way to get the maximum and minimum value in an array is as follows. This is explained in getting the max and min values ​​in the array

var myarray = [5,8,2,4,11,7,3]; // Function to get the Max value in Array Array.max = function( array ){ return Math.max.apply( Math, array ); }; // Function to get the Min value in Array Array.min = function( array ){ return Math.min.apply( Math, array ); }; // Usage alert(Array.max(myarray)); alert(Array.min(myarray)); 
+12
Feb 19 '10 at 5:17
source share

Visual jQuery has great examples of jQuery array functions. (Click "Utilities" on the left tab, and then "Array and Object Operations.")

+2
Jan 25 '09 at 15:25
source share

There, the jQuery plugin called the "rich array" was discussed in the jQuery Rich Array plugin .

+1
Jan 25 '09 at 15:09
source share

You can use underscore.js . This really simplifies the process.

For example, remove the elements from the array that you need to do -

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

and the result will be [1,3].

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

+1
Feb 19 '13 at 10:01
source share

Take a look at the jQuery .grep() and .map() functions

0
Apr 24 2018-11-11T00:
source share

There is also a jquery plugin that adds some methods to the array.

http://www.learningjquery.com/2009/02/implementing-prototypes-array-methods-in-jquery

This plugin implements Prototypes lib 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

0
Jun 26 2018-12-12T00:
source share



All Articles