JavaScript object field splicing

Treasure what you have 2022-06-24 07:20:30 阅读数:852

javascriptobjectfieldsplicing

Project scenario :

I believe everyone must have had the need to javaScript The experience of splicing two object attributes into a large object .


Splicing method

object basicInfo And the object extendInfo Finally, it's spliced into newObject

let obj = {
 basicInfo: {
}, extendInfo: {
} };
let newObject = Object.assign(obj.basicInfo, obj.techInfo);

copyright:author[Treasure what you have],Please bring the original link to reprint, thank you. https://en.javamana.com/2022/175/202206240120044148.html