list To Array - Node.js Data Structure

Node.js examples for Data Structure:List

Description

list To Array

Demo Code


function listToArray(list) {
  var finalArray = []
  for (var node = list;node;node = node.rest) {
    finalArray.push(node.value)/*from   ww w  . j  a  v  a 2 s. c  om*/
  }
  return finalArray;
}

console.log(listToArray(arrayToList([10, 20, 30])));

Related Tutorials