9. n Shortcut 2 – assistance required


I've got to a stage where I'm struggling on the this section, can some advise?

I've got two error messages:

Uncaught SyntaxError: Unexpected token else

Oops, try again. It looks like the n key isn't moving to the next article. Remember to remove the 'current' class from currentArticle and place it on nextArticle.

And all of the code is below:

var main = function() {
    $('.article').click(function() {
    $(document).keypress(function(event) {
        if(event.which === 111); {
        else if(event.which === 110) {
        var currentArticle = $('.current');
        var nextArticle = currentArticle.next();



You have to be careful in the usage of the semi-colon-;

For the Javascript-interpreter a semi-colon-; is an End-of-Statement indicator....

Thus if you write the code like

if(event.which === 111);

the IF statement is ENDED....


That's it, thanks! Not too sure how I didn't spot it.


This topic was automatically closed after 28 hours. New replies are no longer allowed.