r/shittyprogramming • • Mar 10 '23

Javascript is hard sometimes

Post image
512 Upvotes

64 comments sorted by

View all comments

Show parent comment

10

u/great_site_not Mar 10 '23

Lmfao get downvoted idiot, strings are null-terminated. You have to account for the null byte at the end:

[..."hello world"].length--

Learn your shit before you go around calling other people noobs.

2

u/[deleted] Mar 11 '23

:D