eval() is evil

by bhupendra negi

JavaScript

var obj = {name:'don'};
var property = 'name';
console.log(eval("obj."+property));


// can make use without eval()
console.log(obj[property]);
/* 
The eval function is slow. If you're using it unecessarily, you're slowing down your program for no reason. One cause of this is the fact that the engine has to parse the argument as a complete new program 
*/