We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I wanna recieve feedback about my solution in Javascript, I've read other submissions and I know that my code is not de best solution but what things I need to know for code a better solution in a interview?
functiontimeConversion(s){// Write your code heres.trim()//delete blankspaces if there oneswitch(s[s.length-2]){case"A":{if(s[0]==="1"&&s[1]==="2"){letaux=s.replace(`${s[0]}${s[1]}`,"00")aux=aux.slice(0,s.length-2)returnaux}else{s=s.slice(0,s.length-2)returns}}case"P":{if(s[0]==="1"&&s[1]==="2"){s=s.slice(0,s.length-2)returns}else{letaux=s.slice(0,2)aux=(parseInt(aux))+12s=s.slice(0,s.length-2)s=s.replace(`${s[0]}${s[1]}`,aux.toString())returns}}}}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Time Conversion
You are viewing a single comment's thread. Return to all comments →
I wanna recieve feedback about my solution in Javascript, I've read other submissions and I know that my code is not de best solution but what things I need to know for code a better solution in a interview?