• Register
100 points
7 4

If you ever code in HTML then you must know that we cannot compile html documents like C++. So, to prevent and check errors in the document we have to look by yourself. But javascript is a little bit different. It gives errors when we run our program embedded in an html document. With some exceptions, javascript has some similarities, we have to look by ourself to find out the error.
This article discusses “uncaught syntaxerror: unexpected end of input” error.

Cause

Generally this type of error occurs when we miss some kind of operator. For example opening and closing of braces in function and square bracket of arrays. These kinds of errors are syntactical and they are common to show up once in a life of a programmer. 
 

Example

<script>
 $(function() {
 $("#mewlyDiagnosed").hover(function() {
    $("#mewlyDiagnosed").animate({'height': '237px', 'top': "-75px"});
 }, function() {
    $("#mewlyDiagnosed").animate({'height': '162px', 'top': "0px"});
 });
</script>

Here didn’t close the braces of the function. To ignore these kinds of errors, you should indent your code properly so you can find out the error easily in the program.
If you are using IDE like sublime, VS code, atom etc., then you should use extensions like prettier to indent your program. These extensions are life saviours.

Hope this will help.
 

100 points
7 4