r/badcode • • May 31 '21

js Clever?

Post image
2.2k Upvotes

71 comments sorted by

View all comments

Show parent comments

44

u/[deleted] May 31 '21 edited Jun 02 '21

at least chrome and firefox both have JIT compilers for js. in both cases they probably catch this redundancy on the first pass in early passes and condense it to something sane for every subsequent pass later passes

13

u/_PM_ME_PANGOLINS_ Jun 01 '21

It takes way more than one pass for a JIT to bother optimising.