Uncaught SyntaxError: Unexpected end of input on line one

10,658

You're missing a } at the end of your getResistanceStr function. Don't know why it says line 1 but that is the problem.

Share:
10,658
eshimoniak
Author by

eshimoniak

Updated on June 04, 2022

Comments

  • eshimoniak
    eshimoniak almost 2 years

    This error is usually associated with messy close parens, but I'm getting the error on line 1 of the file!

    Here's the javascript(filename: calculate.js)

    var colors = new Array();
    colors["SILVER"]    = -2;
    ...
    

    There's plenty more code later in the file, but I don't think it could be causing this error.

    And in case this is caused by the head declarations, here's the document head.

    <meta id="author" content="Dawson Diaz, Evan Shimoniak">
    <meta id="description" content="Resistor Color Code Calculator">
    <meta id="keywords" content="Resistor, Calculator, Color Code, Electronics">
    <!--Set favicon-->
    <link href="favicon.ico" rel="icon" type="image/x-icon" />
    <!--Include jQuery-->
    <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
    <!-- Latest Bootstrap minified CSS -->
    <link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
    <!-- Custom CSS -->
    <link rel="stylesheet" href="style.css">
    <!--Latest compiled and minified Bootsrap JavaScript-->
    <script src="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
    <!--Calculator-->
    <script src="calculate.js" type="text/javascript"></script>
    <!--Input processing-->
    <script src="ui.js" type="text/javascript"></script>
    

    Any advice is appreciated.

    EDIT: The full code for calculate.js is here