JSNoob
JSNoob

Reputation: 71

Uncaught SyntaxError: Unexpected end of input JavaScript

I'm new to js and keep getting the error "Uncaught SyntaxError: Unexpected end of input" and can't figure out what the error is for the life of me. Does anyone see anything glaring I may be overlooking? Thanks

 <html>
    <head>
        <script type="text/javascript" src="https://www.google.com/jsapi"></script>
        <script type="text/javascript">
        google.load("visualization", "1", {packages:["motionchart"]});
        google.setOnLoadCallback(drawChart);
        function drawChart() {
            var data = new google.visualization.DataTable();
            data.addColumn('string', 'Type of App');
            data.addColumn('date', 'Date');
            data.addColumn('number', 'Sales');
            data.addRows([
              ['Apps',  new Date (2009,0,1), 2380],
              ['Games',  new Date (2009,0,1), 571],
              ['Games', new Date (2009,0,6), 978],
              ['Apps',  new Date (2009,0,12), 14069],
              ['Games',  new Date (2009,0,12), 2307],
              ['Apps', new Date (2010,0,1), 11465],
              ['Games', new Date (2010,0,1), 1520],
              ['Apps',  new Date (2010,0,6), 13490],
              ['Games',  new Date (2010,0,6), 2126],
              ['Apps', new Date (2010,0,12), 20285],
              ['Games', new Date (2010,0,12), 4025],
              ['Games',  new Date (2011,0,1), 2820],
              ['Apps', new Date (2011,0,6), 12757],
              ['Apps',  new Date (2011,0,12), 16785],
              ['Apps', new Date (2012,0,1), 16097],
              ['Apps',  new Date (2012,0,6),17449],
              ['Games',  new Date (2012,0,6), 3694],
              ['Apps', new Date (2012,0,12), 21691],
              ['Games', new Date (2012,0,12), 5774],
              ['Games',  new Date (2013,0,1), 4903],
              ['Apps', new Date (2013,0,6), 23295],
              ['Games', new Date (2013,0,6), 5323],
              ['Apps',  new Date (2013,0,12), 27733],
              ['Games',  new Date (2013,0,12), 9105],
              ['Apps', new Date (2014,0,1), 30771],
              ['Games', new Date (2014,0,1), 7289],
              ['Apps',  new Date (2014,0,6), 32992],
              ['Games',  new Date (2014,0,6), 11752],
              ['Apps', new Date (2014,0,12), 30816],
              ['Apps',  new Date (2015,0,1), 29866],
              ['Games',  new Date (2015,0,1), 10183]
              ]);

    var chart = new google.visualization.MotionChart(document.getElementById('chart_div'));

    chart.draw(data, {width: 600, height:300});
    </script>
    </head>
    <body>
        <div id="chart_div" style="width: 600px; height: 300px;"></div>
    </body>
    </html>

Upvotes: 0

Views: 10932

Answers (2)

Wade Anderson
Wade Anderson

Reputation: 2519

JS Lint is your friend. You are missing a closing '}' at the end of your drawChart function (line 45).

Upvotes: 3

Igor
Igor

Reputation: 15893

you are missing closing "}" for function drawChart() {.

Upvotes: 2

Related Questions