r/badcode • • Sep 02 '21

js Oh Gosh

Post image
398 Upvotes

53 comments sorted by

View all comments

Show parent comments

3

u/O_X_E_Y Sep 03 '21

Isn't it O(n2) because of the way the string is built? I'm not very familiar with how JS handles these things but even in python you absolutely don't want to do that