Use of jquery Extend

Source: Internet
Author: User

$.extend (DES,SRC,SRC2);

The API documentation is written so, but when SRC,SRC is not a string, the result is that each character of the string is split separately and placed on des

  var ext = {name:111}  $.extend (ext,{age:999})  Console.log (EXT)

==>object {

When SRC is not an object

1 varext = {name:111}2$.extend (ext, "What's the situation!!! "I'll Go!" ")
===>object { 0: "I", 1: " Go ", 2: "! ", 3: " what ", 4: ", 5: "Love", 6: 7: " ah ", 8: "! ", 9: "! ", 10: "! ", name: 111}

Test to this, suddenly think of the order of extend, it seems that the right side of the tree is covered by the same property values on the left side of the object, see the result of the traversal is not like this, but first from the right side, if the left side has the same property is not

Read the value of it.

1 var ext = {name:111}2 $.extend (ext,{aa:11,tt:33},{aa:22}, "I go! ")3 console.log (EXT)

==>Object {

 

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.