Reporting a bug


#1



https://www.codecademy.com/en/courses/web-beginner-en-zmn0b/0/6?content_from=make-an-interactive-website%3Ayour-first-program


I'm getting an "Uncaught SyntaxError: Unexpected identifier" message. So there is a bug in my code, which apparently doesn't work on the browser. Clicking on "Save & Submit Code", however, marks the task as completed.


var main = function(){
    $('.icon-menu').click(function()

      $('.menu').animate(
                         {left: '0px'}, 200
                        );
      $('body').animate(
                         {left: '285px'}, 200
                       );


    );};

$(document).ready(main)


#2

Hi @firfir,

Thanks for letting us know about this!

Unfortunately, we are unable to fix the course right now, since it's among the courses being phased out by Codecademy, to be replaced by newer, better content.

If you're wondering what's wrong with your code, you've missed up the order here:

);};

It needs to be }); instead, and you should only use one semi-colon (;) per line :slight_smile:


#3

Thank you for your reply. I'm a bit puzzled as to why );}; has to be flipped. Looking at the order of functions, the function click( comes first. So it makes sense to enclose it with ) before enclosing the function(){ within main.


#4

@firfir The closing curly brace (}) there isn't closing the main function though, it's closing the function() {...} part:

                   // ↓ open the event listener
$('.icon-menu').click(function() {
                               // ↑ open the event listener's
                               // function to do stuff in
  // ...
// now we close them from the inside out
// so, function() {...} comes first
// then $('.icon-menu').click(...);
});

Does this help?


#5

Perfect!

Thanks a lot.


#6

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.