JSON Performance comparison of eval and new Function
Hello,
Why new Function is used in the code below instead of eval?
According to this blog post eval is generally faster.
- // Try to use the native JSON parser first
- return window.JSON && window.JSON.parse ?
- window.JSON.parse( data ) :
- (new Function("return " + data))()