SyntaxError: Unexpected end of input

var numbers = function(){
    for (i=1; i<=20; i++){
        if(i%3===0 || i%5===0){
            if(i%3===0 && i%5===0){
            else if (i%3===0){
            else if (i%5===0){


Definition of the function is not closed, you have to add }; at the end of the script.


Thanks. But now it returns me " It looks like you printed out the wrong number of items."


You need to execute your function:



One thing that helps a lot in such cases is to copy your code, open the console in your browser (right click - inspect and go to the console) and paste your code, press enter to run it and look at the error, the console tells you where your mistake is.


Thank you for the advice!


thanks great advice this advice help me a lot


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