1024programmer Java Native js realizes copying objects and extending objects similar to the extend() method in jquery_javascript skills

Native js realizes copying objects and extending objects similar to the extend() method in jquery_javascript skills

The extend() method of jq can easily implement the extended object method. The syntax is as follows: $.extend(obj1,boj2,obj3);

What needs to be implemented now is: native js realizes copying objects and extending objects, similar to the extend() method in jq. The specific examples are as follows:
There are 3 object literals:

 var o1={hello:1,old:555},
 o2 = {
 abc: 55555555,
 hello: 2,
 fun: function() {
 alert(111);
 }
 },
 o3={third:9999};

Achieve goals:

Copy the o1 object, extend the object properties and methods of o2 and o3 into the previously copied object and output it.

 

This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/629634

author: admin

Previous article
Next article

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索