javascript Program to Reverse a List using Data Swapping
class Node { constructor ( val ) { this . data = val ; this . prev = null ; this . next = null ; } } function newNode ( val ) { var temp = new Node ( ) ; temp . data = val ; temp . prev = temp . next = null ; return temp ; } function printList ( head ) { while ( head . next != null ) { document . write ( head . data + " " ) ; head = head . next ; } document . write ( head . data ) ; }