Write a function named max
that takes an argument named list
, which is the head cell of a linked list in the form below and returns the largest number in the data field of any cell.
var tail = { next: null };
var cell2 = { data: 12, next: tail };
var cell1 = { data: 45: next: cell2 };
var head = { next: cell1 };