Return not in function


#1


Syntax error: return not in function
I do not exactely know why this error occours. Can anyone pls. help?

https://www.codecademy.com/de/courses/javascript-beginner-en-qDwp0/0/3?curriculum_id=506324b3a7dffd00020bf661


for(i = 0 ; i > 3 ; i++)
    {
        console.log("'For' schleife");
    }

var j = true;
while (j)
    {
        console.log("'While' Schleife");
        return (j = false);
    }


#2

Looking at the error shown in your console, the issue should be here.

You could simply leave it as:

j = false;

#3

Now i see. I do not have to return something...
Because it is a loop... TX...


#4

Exactly!

You're welcome. Have fun coding! :slight_smile:


#5

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