cancel
Showing results for 
Search instead for 
Did you mean: 

How to exit the java script code completly

pakula123
Participant
0 Kudos

Hi experts, How can I code for completely exiting the java script code .  I have used break in for loop  but  that is only for that iteration. Please suggest. Best regards, pradeep.

Accepted Solutions (1)

Accepted Solutions (1)

cris_hansen
Advisor
Advisor
0 Kudos

Hello Pradeep,

You can try using:

return;

Kind regards,

Cris

pakula123
Participant
0 Kudos

Hi Cristiano, It says return ; is out side function. Best regards, pradeep.

cris_hansen
Advisor
Advisor
0 Kudos

Hi Pradeep,

So, return; does not work?

You should use try/catch block, then, to stop the execution call:

throw new Error("");

Does it fit your needs?

Regards,

Cris

pakula123
Participant
0 Kudos

Hi Cristiano, I did in a different way . And have solved problem with exiting . Thank you for your support. Best regards, pradeep.

clemens_gantert
Active Participant
0 Kudos

Hello Pradeep,

you can ignore the validation error "return used ouside of function" (or similar). The validation is needlessly strict. We relaxed this validation with SP03.

Also, Cristiano's approach of throwing an error should not be necessary. You should always try to stop a script using the "return" statement instead.

Best Regards,

Clemens

pakula123
Participant
0 Kudos

Thank you Clemens. Best regards, pradeep.

Answers (0)