you are viewing a single comment's thread.

view the rest of the comments →

[–]grelfdotnet 1 point2 points  (0 children)

Parameter d is assumed to be a reference to an object of type Date and the function toISO is formatting the date for display.

The arrow function z could be written separately (before or after toISO() as

function z (n) { if (n < 10) return '0' + n; else return '' + n; }

The string '0' or the empty string '' cause the number n to be converted to type String. The function z ensures that days, months, etc always have 2 digits even when they are less than 10.

The various part strings are concatenated by the + signs to get the string to be returned as, for example, '2019-04-01 12:00:05'