This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function timeConversion(s) { | |
// substring the AM/PM from the string | |
let clean = s.substring(0, 8) | |
// we divide our string with a split by : | |
let nerArr = clean.split(':'); | |
// Check if the string (s) includes PM | |
if(s.includes("PM")){ | |
// If our first position it's different than 12 | |
if(nerArr[0] !== '12'){ |