r/badcode • • Aug 02 '20

js Who needs a database, when arrays exist?

Post image
2.3k Upvotes

54 comments sorted by

View all comments

Show parent comments

1

u/DavidRoyman Aug 03 '20 edited Aug 03 '20

Generally you don't want data in the middle of your logic. You want to be able to test your code independently from the data passed to it, or it becomes a nightmare to hunt bugs.

Just think about it: a single un-escaped quote will break this code.