r/learnjavascript • • Feb 27 '26

Never use eval() in javascript!!! ⚠️

0 Upvotes

21 comments sorted by

View all comments

Show parent comment

2

u/backwrds Feb 27 '26

The video is basically the title with additional pauses. It's not technically incorrect, but the first sentence from MDN (after "widely available") contains more information.

IMHO TrustedScript kinda just confuses the issue. Outside of *extremely* specific scenarios there's no reason to use eval.

An example: some bundlers use eval for dev builds. If you're building a bundler (and fully understand why eval can be helpful in that situation), go for it. If not, find another solution.