Develop a component that merges two hardcoded arrays of objects based on a common property and displays the merged array.
HardProblem Statement
Develop a component that merges two hardcoded arrays of objects based on a common property and displays the merged array.
Sample Input
[{ "id": 1, "name": "Alice" }, { "id": 2, "name": "Bob" }]
[{ "id": 1, "age": 25 }, { "id": 2, "age": 30 }]Sample Output
Merged Array: [{ id: 1, name: 'Alice', age: 25 }, { id: 2, name: 'Bob', age: 30 }]Limits
Time: 2s · Memory: 256 MB
Code Editor
Log in to submit00:00
Try your code in this preview. Submit marks it done.
import React from "react"; const MergeArrays = () => { return ( <div> {/* Display the merged array */} </div> ); }; export default MergeArrays;