How can we go about accomplishing the following?
Challenge
Merge two arrays without looping.
Scenario
Array 1 contains user information.
{
"ownerid":"123",
"name":"John Doe",
"email":"jdoe@contoso.com"
},
{
"ownerid":"567",
"name":"Jim Johnson",
"email":"jjohns@contoso.com"
}
Array 2 contains product information.
{
"product":"25-inch widgets",
"price":"$65.00",
"ownerid":"123"
},
{
"product","30-inch widgets",
"price":"$250.00",
"ownerid":"567"
}
Result in Array 3
{
"product":"25-inch widget",
"price":"$65.00",
"ownerid":"123",
"name":"John Doe",
"email":"jdoe@contoso.com"
},
{
"product":"35-inch widget",
"price":"$250.00",
"ownerid":"567",
"name":"Jim Johnson",
"email":"jjohns@contoso.com"
}
Requirements
- No looping - takes too long with the number of products
- No third-party plugins
- Can use premium features