DEV Community

Discussion on: Day 1: Who likes it? - A coding challenge with solutions

Collapse
 
istealersn profile image
Stanley J Nadar

Thanks for sharing King.

You can concise this code a bit further and avoid repeating the same strings or values using temporals in Javascript.

Here is my version:
jsfiddle.net/iStealersn/12uetjgv/4/

Collapse
 
jamesthomson profile image
James Thomson

Some good improvements to make things more DRY, but the nested ternary's make my brain bleed. I feel like this would be much more legible using a switch or even just if/else statements.

Collapse
 
istealersn profile image
Stanley J Nadar

Yeah I agree, had the same feeling after completion. If/Else statements make it look long while switch may definitely help gotta give a shot

If you have an improved version please share, it will be helpful

Collapse
 
ubahthebuilder profile image
Kingsley Ubah

Awesome!

Thanks for sharing