Write a function that takes a string formatted as key:value;key:value;... (e.g., "name:niraj;age:56;email:dhirajchaudhari@gmail.com") and converts it into a JavaScript object. Each key in the string should become a property of the object, and its corresponding value should be assigned to that property.
Edge Cases:
Split the String Use split(";") to separate key-value pairs. Iterate and Process Pairs Loop through each pair. Use split(":") to separate the key and value. Handle Edge Cases Ignore empty strings. If a key appears multiple times, only store the last occurrence. Return the Final Object Store parsed values in an object and return it.
Given an array of objects, where each object has the properties role (string) and name (string), organize the data by grouping all names under their respective roles. For each unique role, create an array of names that belong to that role.
Example Input:
[
{ role: "admin", name: "Alice" },
{ role: "user", name: "Bob" },
{ role: "admin", name: "Charlie" },
{ role: "moderator", name: "David" }
]
Expected Output:
[
{ role: "admin", name: ["Alice", "Charlie"] },
{ role: "user", name: ["Bob"] },
{ role: "moderator", name: ["David"] }
]

Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
What is recursion?