javascript - Uncaught SyntaxError: Unexpected end of input line 1 -


hi there trying figure out going wrong. getting error

uncaught syntaxerror: unexpected end of input in line 1

which is

 var itemlist = new array(); 

a snippet of code included

var itemlist = new array();  $( document ).ready(function(){ var $newitem = $('#newitem'); var $itemlist =$('#itemlist'); var itemtouchstart; var itemtouchend; var itemtouchstartx; var itemtouchendx;  if( window.localstorage) //when application starts check if there data {     itemlist = json.parse(window.localstorage.getitem('itemlist')); }  if(null !== itemlist) {     (i=0;i<itemlist.length; i++)     {         var itemnew = '<li data-key="'+ itemlist[i].key +'"><span>'  +itemlist[i].item +'</span></li>';         $itemlist.append(itemnew);     }  } else {     itemlist = new array(); } 

the line number of error wrong. problem @ end, never close function you're passing ready or call it. add }); @ end.

if that's missing because quoted a

...snippet of beginning of code...

...then answer there's nothing wrong line 1 that's apparent question. weird errors can down invisible characters in source, expect see illegal character error rather unexpected end of input. unexpected end of input pretty says: have control structure of kind open , haven't closed when parser reaches end of code text.


i find meteor javascript parser page quite handy diagnosing syntax errors.


Comments