DEV Community

Discussion on: Daily Challenge #24 - Shortest Step

Collapse
 
maxart2501 profile image
Massimo Artizzu

I was about to submit something like that, so have my applause instead 👏🎉

A little more thinking on the problem can really simplify the solution!

(On a side note, I wouldn't extend a native prototype, but that's out of context now 😅)

Collapse
 
wheatup profile image
Hao

That was my original version, then I thought writing two functions might confuse people so I changed it into this. It's just for the sake of demonstration and better readability.🤗But you were right, it is a bad habit to extend a native prototype.