Please Help (In spite of an error, the system allows to continue..)


#1

Greetings

My JS Code in this exercise is the following:

var main = function() {

$('.icon-menu').click(function()
$('.menu').animate({
left: '0px'
}, 200);

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

$(document).ready(main)

I checked already my CSS and it doesnt have any HTML code.

In spite of all that, each time that I arrive to this point, I obtain the following error message:

Uncaught SyntaxError: Unexpected identifier

But in spite of that error, the system allows me to continue as if no error has found....

Please, if somebody knows how to fix that, let me know.

Thanks for your attention.

Best Regards


#2

Looking at the old forums I found the answer. The working code is the following:

var main=function(){
$('.icon-menu').click(function(){ /*open function bracket */
$('.menu').animate({
left: '0px'
}, 200);

$('body').animate({
left: '285px'
}, 200)
}); /* close function bracket, then container*/
}; /* then close "main" bracket */

$(document).ready(main);

Note that the ";" after:

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

is an error, so when this is removed form the code, the error dissappear.