I currently have an array called ExampleArray which contains different objects with properties like "No", "Name", and "subject". I want to transform this array into a new format where the "subject" property is an array of strings instead.
var ExampleArray=[]; //example array Name
ExampleArray.push ({
"No": 1,
"Name": "BB",
"subject": "NS"
},{
"No": 1,
"Name": "BB",
"subject": "PS"
},{
"No": 1,
"Name": "BB",
"subject": "KS"
}
The desired output would be:
var array = {
"No": 1,
"Name": "BB",
"subject":
{
["NS","SS","KS"]
}
}
What is the best way to achieve this transformation?