About $.each in jquery get the use of various return type data

Source: Internet
Author: User

var arr = ["One", "one", "three", "four"];       function () {         alert (this);      });  

The results for each of the above outputs are: One,two,three,four

var arr = ["AAA", "BBB", "CCC" ];       function (i,a) {        alert (i);    // I is the ordinal  of a loop alert (a);  // A is the value

var arr1 = [[1, 4, 3], [4, 6, 6], [7,, 9]]     function(i, item) {        alert (item[0< c6>])  ;

In fact, ARR1 is a two-dimensional array, item is equivalent to taking each one-dimensional array,
Item[0] Relative to the first value in each one-dimensional array
So the above each output is: 1 4 7

var obj = {one:1, two:2, Three:3, Four:4};      function (Key, Val) {         alert (Obj[key]);
alert (key); Key
Alert (val); Value

The output is: 1 2 3 4

About $.each in jquery get the use of various return type data

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.