There is a string imitating a CSV file, you have to pass it into a function and get an array consisting of the objects. How to do it? Please help.
function STRtoArray (str) {
// Code here
}
var str = 'Name,Age,Car,wife \n John,25,,true\n Ben,31,wolksvagen,false'
The result is expected as follows:
[
{
Name: John,
Age: 25,
Car: false,
wife: true
},
{
Name: Kolya,
Age: 31,
Car: wolksvagen,
wife: false
}
]