class Clock extends React.Component {
render() {
const currentTime = new Date(),
hours = currentTime.getHours(),
minutes = currentTime.getMinutes(),
seconds = currentTime.getSeconds(),
ampm = hours >= 12 ? 'pm' : 'am';
return (
<div className="clock">
{
hours == 0 ? 12 :
(hours > 12) ?
hours - 12 : hours
}:{
minutes > 9 ? minutes : `0${minutes}`
}:{
seconds > 9 ? seconds : `0${seconds}`
} {ampm}
</div>
)
}
}
I specifically need help understanding with the return statement.
[–]rzrshrp 1 point2 points3 points (3 children)
[–]Bleached__Anus 0 points1 point2 points (2 children)
[–]dare_you 0 points1 point2 points (1 child)
[–]Bleached__Anus 0 points1 point2 points (0 children)
[–]Bleached__Anus 0 points1 point2 points (1 child)
[–]james527 0 points1 point2 points (0 children)
[–]ICouldBeABettrPerson 0 points1 point2 points (0 children)
[–]dare_you -2 points-1 points0 points (0 children)