write ocaml program that returns max value of a digit in javascript

let max_digit str =
  let max_value = ref '0' in
  String.iter (fun c ->
    if Char.equal c '0' then max_value := Char.max !max_value c
  ) str;
  !max_value;;
161 chars
7 lines
index.tsx
function maxDigit(str) {
    return Math.max(...str.split('').map(Number));
}
78 chars
4 lines

related categories

gistlibby LogSnag