0

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>
0

2 Answers 2

3

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

Sign up to request clarification or add additional context in comments.

Comments

2

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.