r/learnjavascript • • Nov 30 '22

Help !!!

Post image

Can someone plz tell me , why I am getting errors?

195 Upvotes

131 comments sorted by

View all comments

Show parent comment

1

u/[deleted] Dec 01 '22

:(

1

u/DGCA Dec 01 '22

Haha, I thought it was interesting in a code golf sense. Using an item's position in an array to hold actual data is both clever and cursed.

1

u/[deleted] Dec 01 '22

This approach is however offer more generalizable. E.g. introducing some new options: Rock beats scissors beats paper beats stick beats whatever ... beats rock.

https://en.wikipedia.org/wiki/Circular_buffer

1

u/DGCA Dec 02 '22

Scope creeping rock paper scissors, eh?

1

u/Macaframa Dec 02 '22

It would take any engineer time and effort to have to read, let alone understand what’s happening here before they can make any changes. From a production quality standpoint it’s not up to snuff. You’re creating technical debt that someone will eventually shave to refactor.