i have code like below,
if (filteredIds.length > 0) {
notify({
title: `${
type === "type1"
? 'type1 checks'
: 'type2 checks'
} started.`,
});
} else {
notify({
title: `${
type === "type1"
? 'type1 checks'
: 'type2 checks'
} have been already running on selected id.`,
});
}
the above code works. But i want to use ternary operator to be used instead of if and else as the notify thing seems to be repetitive.
i want something like having the ternary operator in notify itself to return necessary text based on filteredIds length and type.
notify({
title: `${ //condition here
type === "type1"
? 'type1 checks'
: 'type2 checks'
} started.`,
});
Basically i want the if else code to be less code. Could someone help me with this. I am new to programming and not sure how to use nested ternary operator. thanks.
have been already running on selected id.andstartedbased on length of filteredId?