var timeSplit = timeCaption.innerText.trim().split(' ');
will yield an Array of ["10:00", "–", "18:00"]
var startStr = timeSplit[0].split(':');
will yield an Array of ["10", "00"]
var res = startStr.map(parseInt);
will yield an Array of [10, NaN]
however
var res = startStr.map(function (x) {
return parseInt(x);
});
works correctly and will yield the "expected" Array of [10, 0]
I expect each string to be passed to parseInt which returns the correct interger value (and doing that separately also yields the correct result, just like the working code).
What am I missing here?
var res = startStr.map(x=>parseInt(x));as such not a million miles of what you did.