I have array with data :
["05:45", "06:00", "06:15", "06:30", "06:45", "07:00", "07:15", "07:30", "07:45", "08:00", "08:15", "08:30", "08:45", "09:00", "09:15", "09:30", "09:45", "10:00", "10:15", "10:30", "10:45", "11:00", "11:15", "11:30", "11:45", "12:00", "12:15", "12:30", "12:45", "13:00", "13:15", "13:30", "13:45", "14:00", "14:15", "14:30", "14:45", "15:00"]
For this data i need to replace numbers which are not equal to zero, so i must have array like this:
["", "06:00", "", "", "", "07:00", "", "", "", "08:00", "", "", "", "09:00", "", "", "", "10:00", "", "", "", "11:00", "", "", "", "12:00", "", "", "", "13:00", "", "", "", "14:00", "", "", "", "15:00"]
For this i create function but for some reason it's not working:
var intervals = ["05:45", "06:00", "06:15", "06:30", "06:45", "07:00", "07:15", "07:30", "07:45", "08:00", "08:15", "08:30", "08:45", "09:00", "09:15", "09:30", "09:45", "10:00", "10:15", "10:30", "10:45", "11:00", "11:15", "11:30", "11:45", "12:00", "12:15", "12:30", "12:45", "13:00", "13:15", "13:30", "13:45", "14:00", "14:15", "14:30", "14:45", "15:00"]
function hideNumbers() {
for (var i = 0; i < intervals.length; i++) {
var c = intervals[i].split(':');
var time = parseInt(c[1])
var result = (c[0] + ':' + c[1])
if (time != 00) {
intervals[i].replace(result, "");
}
}
console.log(intervals)
}
hideNumbers();
So what is the problem?