【发布时间】:2019-01-04 03:56:11
【问题描述】:
我有 2 个对象
{
"Simon": {
"occupation": "garbage man",
"age": "21"
}
}
还有这个
{
"wife": "Kate"
}
我如何将第二个对象插入到第一个对象中以得到结果
{
"Simon": {
"occupation": "garbage man",
"age": "21",
"wife": "Kate"
}
}
即使有妻子也可以应用:
{
"wife": "Shandia"
}
结果
{
"Simon": {
"occupation": "garbage man",
"age": "21",
"wife": "Shandia"
}
}
有没有办法使用 lodash 实现这一点?
【问题讨论】:
-
为什么选择 Lodash?就
Object.assign
标签: javascript json node.js ecmascript-6 lodash