Sometimes the log, including the Application log and Script log, doesn't tell which line the error occurs like the screenshot below :
How can I know where the problem is ? (except print logs in the service to guess )
ThingWorx version : 8.5.5
The script editor here is not a fully functional compiler, so there's not a warning for which line has the error, and normaly JS scripts here are short so it's not hard to locate the problem.
You can use try catch to find the error, or cut scripts to smaller sections and test them indepently (check if the results of each section is correct)