I have two JavaScript obj like so:
const objOne = {
"firstname": "xzxz",
"lastname": "xzxzxzx"
};
const objTwo = {
"title": [
{
"name": "foo",
"table": "First"
},
{
"name": "bar",
"table": "Second"
}
]
};
and I want to combine them like below (not sure if "combine" is the appropriate word but hopefully make sense)
{
"firstname": "xzxz",
"lastname": "xzxzxzx",
"title": [
{
"name": "foo",
"table": "First"
},
{
"name": "bar",
"table": "Second"
}
]
}
so far I tried the below
let result = [];
results.push(objOne);
results.push(objTwo);
but surely the result is not the one I want and it make sense as I create an array and I push into both objects.
[
{
"firstname": "xzxz",
"lastname": "xzxzxzx"
},
{
"title": [
{
"name": "foo",
"table": "First"
},
{
"name": "bar",
"table": "Second"
}
]
}
]