When should I use eval()?
NEVER. That’s got that off my chest. eval() is possibly the most dangerous thing ever. It’s basically a way to execute arbitrary code from a string or variable. Here’s a few reasons why it’s dangerous. It leaves you open to injection attacks. In Javascript, eval() forces the engine to drop into Interpreter mode, which slows down your application, and it will remain slow, as there’s no opportunity for optimisation-level caching to take place....