I have interesting task. I solved the half of it but can't to find the solution to solve the rest. Hope someone can point me to the right direction.
I found the solution close to mine task. But mine is slightly different and use ES6.
There is nested object.
let someList = {
   value: 1,
   next: {
      value: 2,
      next: {
         value: 3,
         next: {
            value: 4,
            next: null
            }
         }
    }
};
I received all values.
function reversePrint(linkedList) {
Object.keys(linkedList).map(key => {
let myKey = linkedList[key];
typeof myKey == "object" ?  console.log(reversePrint(myKey)) : console.log(myKey);
});
}
reversePrint(someList);
But the problem is: how i can get all values in reverse order?
Fiddle: https://jsfiddle.net/L83puqbz/17/
I tried use reduce for to make array and reverse it but every value was in separate array.
Fiddle https://jsfiddle.net/L83puqbz/20/
Any help will be greatly appriciated.
 
     
     
    