Reputation: 19543
I have a long string that I am calling eval on. It's resulting in a syntax error. I'm trying to figure out where in the eval string the syntax error is. The page is executing in IE 9.
This code string is the result of a large process and is very legacy code. The architecture can't change now as that is out of the scope of the defect I'm working on. It's not a great system and certainly not a system I would write, but it is what it is.
Upvotes: 0
Views: 128
Reputation: 140220
You could replace the eval
with console.log
, run the logged string through jsbeautifier and spot the syntax error.
As in:
eval( "very huge string" )
-->
console.log( "very huge string" )
Upvotes: 2
Reputation: 69934
Tell your app to spit out your string before eval-ing and running into the syntax error. You can now either
Upvotes: 0
Reputation: 10529
It is better not to use eval. Put your code out of eval()
and try again
Upvotes: 0
Reputation: 943470
By refactoring so you don't need to use eval, there is almost always a better way.
Upvotes: 0