11

How can I stop script executing when if condition is met? Is it possible to do it without else? For example:

if(data == 'false')
{
stop
}
rest of the function...
0

1 Answer 1

27

You can return out of the function:

if (data == 'false') {
    return false;
}
Sign up to request clarification or add additional context in comments.

1 Comment

Who could guess that there was an easy solution :D. Thank you for your help :).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.