I am not sure if I understood your question well but if the call to your test function is within the avoid function like below:
function test () {
alert("hi");
}
function avoid () {
if(condition) {
//here avoid to call test
return false;
}
test();
}
Then a simple return false could solve your problem, I am not sure if your functions are using events but if that is the case this is a good post that you can read about preventDefault and return false : enter link description here
if test is at the same level of avoid like below :
function test () {
alert("hi");
}
function avoid () {
if(condition) {
//here avoid to call test
return false;
}
return true;
}
// below is your functions call
check = avoid();
if(check){
test();
}
This post explains how to exit from a function: enter link description here
I hope that helps.