JavaScript changing object list to array. return undefined -


function listtoarray(list){     var newarray = [];     repeat();     function repeat(){         newarray.push(list.value);         if(list.rest == null){             return obj = newarray; // don't know why returns undefined here         }         else {         list = list.rest;         repeat();         }     } }  // , return array  function return(){     var listvar = [5, 4, 3, 2, 1];     return obj = listvar; } 

this function change obj when in console, returns undefined. can me? please

just return newarray - can't return assignment that.


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -