i have write a function to place "," and "and" in between three links how could i reduce if else statements. In javascript, i get count if count is not zero means link have to show otherwise it shoud be hide
in following scenario
function inst_grammer()
{
var otherCount = parseInt($('.global_other_count').html());
var initCount = parseInt($('.global_init_count').html());
var signCount = parseInt($('.global_sign_count').html());
var init_class = $('.inst_init');
var sign_class = $('.inst_sign');
if (signCount != 0 && initCount != 0 && otherCount == 0)
{
init_class.html('').fadeOut();
sign_class.html(' and ').fadeIn();
} else if (signCount == 0 && initCount != 0 && otherCount != 0)
{
init_class.html(' and ').fadeIn();
sign_class.html('');
} else if (signCount != 0 && initCount != 0 && otherCount != 0)
{
init_class.html(' and ').fadeIn();
sign_class.html(' , ').fadeIn();
}
else if (signCount != 0 && initCount == 0 && otherCount == 0)
{
init_class.html('').fadeOut();
sign_class.html('').fadeOut();
}
else if (signCount == 0 && initCount != 0 && otherCount == 0)
{
init_class.html('').fadeOut();
sign_class.html('').fadeOut();
}
else if (signCount == 0 && initCount == 0 && otherCount != 0)
{
init_class.html('').fadeOut();
sign_class.html('').fadeOut();
}
else if (signCount != 0 && initCount == 0 && otherCount != 0)
{
init_class.html('').fadeOut();
sign_class.html(' and ').fadeIn();
}
}