Thursday, February 20, 2014

How to check where is syntax error in javascript?

By simply looking at a javascript file one cannot say where is the syntax error (if any). And there is no compiler as such during our development which will say that. We simply write DOM methods or functions in the javascript unlike Java (Eclipse is a tool which will validate the source code during development). But this is not available in javascript. However during development of any application in cordys there will be a place where you add events/javascript functions in any XForm. Cordys will be able to tell if the XForm has any errors but it won't tell where exactly the error is (eg., will not tell the line number of the error) which will make difficult for a developer to locate where exactly is the error,

There is an online website which will validate the javascript and will notify the error if there are any,

All you have to do is to copy the javascript and paste in the place provided in the website. A sample screen is shown below

And the website you are looking for is given below

On Click of the lint button it will show the errors if there are any in the javascript file.


  1. good..:) but there is one more way...we can take the entire scrip and paste in a text file and save it with .js extension. And try opening this file with a double click on will tell u where exactly the error is with line number..

  2. Finally someone commented with another approach :) I encourage that. But can you be specific about what is the editor you are using to open the javascript file? Everyone wouldn't have that editor right? Then they will open it from notepad which doesn't meet the purpose again.

  3. you don't have to open it with any editor...simply double-click on that file will open "Microsoft script console" and which will tell you the error if any :-)

  4. Yes if "Microsoft script console" is present. And also another thing with this is, using this editor we can find out error only at one place (even your script has errors at multiple lines) but this can be eliminated using the approach told in the post.