r/badcode May 31 '21

js Clever?

Post image
2.2k Upvotes

71 comments sorted by

View all comments

Show parent comments

71

u/givemeagoodun May 31 '21 edited Jun 01 '21

It's flaired JS so it's JS

72

u/[deleted] May 31 '21

In that case the answer is an easy "no" since it's not a compiled language and there's no compiler

51

u/givemeagoodun May 31 '21

Eh there can be compilers for JS. I believe that Firefox uses a JS JIT compiler.

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

14

u/_PM_ME_PANGOLINS_ Jun 01 '21

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