Console error in Chrome Dev Tools console points to the wrong line of code as the origin of error

I’m working on a Shopify site, adding jQuery and JavaScript to customize the site to the clients needs. Whenever a JavaScript error pops up on the Chrome Dev Tools console it shows which line the error occurred on in the code. However, Dev Tools seems to get this line wrong consistently, it always points to a line that’s 3-4 lines below where the actual error occurred. And I can’t seem to figure out why. I have tried pretty-printing the code to see if that changes anything.

Console error image

Code highlighted by Dev Tools

The templating language being used here is Liquid, if that helps.

Thanks in advance to anyone who can figure out why this is happening!

Source: Ask Javascript Questions

LEAVE A COMMENT