I am faced with an array structure like this:
var arrays = [
{
"value": "$6"
},
{
"value": "$12"
},
{
"value": "$25"
},
{
"value": "$25"
},
{
"value": "$18"
},
{
"value": "$22"
},
{
"value": "$10"
}
];
My goal is to transform this array into a single indexed array that looks like the following:
[{
"value": "$6",
"Next": {
"value": "$12",
"Next": {
"value": "$25",
"Next": {
"value": "$25",
"Next": {
"value": "$28",
"Next": {
"value": "$22",
"Next": {
"value": "$10"
}
}
}
}
}
}
}]
I am looking for a way to push the elements of the second array into the first array in the format shown above using JavaScript linked lists.