No visible cause for “Unexpected token ILLEGAL”

后端 未结 11 2255
轻奢々
轻奢々 2020-11-22 00:09

I\'m getting this JavaScript error on my console:

Uncaught SyntaxError: Unexpected token ILLEGAL

This is my code:

11条回答
  •  失恋的感觉
    2020-11-22 01:00

    I got this error in chrome when I had an unterminated string after the line that the error pointed to. After closing the string the error went away.

    Example with error:

    var file = files[i]; // SyntaxError: Unexpected token ILLEGAL
    
    jQuery('#someDiv').innerHTML = file.name + " (" + formatSize(file.size) + ") "
        + "Error is here";
    

    Example without error:

    var file = files[i]; // No error
    
    jQuery('#someDiv').innerHTML = file.name + " (" + formatSize(file.size) + ") "
        + "Error was here";
    

提交回复
热议问题