The function in the tutorial copied below returns Thu Apr 27 2006 00:00:00 GMT+0900 (Japan Standard Time)
Can someone explain what the number pairs 11.4, 8,2 and 5,2 do, and why is one of the numbered pairs followed by -1? I assume those numbered pairs are passed into function number at as values for start and length? is that correct? by why those specific numbers and what`s with the -1?
function extractDate(paragraph) {
function numberAt(start, length) {
return Number(paragraph.slice(start, start + length));
}
return new Date(numberAt(11, 4), numberAt(8, 2) - 1,
numberAt(5, 2));
}
show(extractDate("died 27-04-2006: Black Leclère"));