Is there a way to convert a JavaScript array into JSON format?
[{
"userName": "Rodrigo",
"date": "April 25, 2017",
"score": 5
}]
[{
"userName": "Jon",
"date": "April 24, 2016",
"score": 4
}]
Error: There is a parser error on line 5
This is my code snippet
var result = [];
var allInfo = {
userName,
date,
score
};
result[i] = allInfo;
return JSON.stringify(result);