Simple function to capture the value of an array, separate by ":" and create a new array
<!-- language: lang-js -->
function sumArrayHours( arrayHr )
{
var hr, min, hours;
$.each(arrayHr, function(key, element) {
hours = element.split(':');
hr = parseInt(hours[0], 10);
min = parseInt(hours[1], 10);
console.log('hr: ' + key + ' ' + 'min: ' + element);
});
}
var arrayHr = ["04:38", "05:49", "12:47"];
sumArrayHours( arrayHr );
Is returning: Uncaught TypeError: Cannot read property 'split' of undefined
Aucun commentaire:
Enregistrer un commentaire