DEV Community

Discussion on: Time conversion

 
kecbm profile image
Klecianny Melo

Hi @rcalvanese, how are you? How did you run the code? Was it with another string for the time in the constant "s"?

Thread Thread
 
rcalvanese profile image
rcalvanese

Hi! I ran it here jsfiddle.net/cx9pa41n/

Thread Thread
 
kecbm profile image
Klecianny Melo

Hi! I understood. You can replace const with var in this line to resolve this error: var [hour, minute, second] = s.slice(0,8).split(':');