im making it display the time in javascript but when it returns the time it is always undefined. below is the code
im not really sure why it always returns undefined though.
$('#bar #time').html(hours + ":" + minutes + " " + suffix); var currentTime = new Date() var hours = currentTime.getHours() var minutes = currentTime.getMinutes() //decides if am or pm var suffix = "AM"; if (hours >= 12) { suffix = "PM"; hours = hours - 12; } if (hours == 0) { hours = 12; } // shows 0 before the minutes if under 10 if (minutes < 10) minutes = "0" + minutes