Driver code
var head = null ; head = create ( head , 1 ) ; head = create ( head , 2 ) ; head = create ( head , 3 ) ; head = create ( head , 4 ) ; head = create ( head , 5 ) ; var n = 2 ; document . write ( " " ) ; display ( head ) ; head = removeNthFromEnd ( head , 2 ) ; document . write ( " " ) ; display ( head ) ;