I have developed a function that is supposed to evaluate all scenarios and provide an immediate result if one of the cases does not match.
const addText = (data, addAlternative) => {
return (data !== 'N/T' || data === 0 || data) ? data : addAlternative;
};
console.log(addText('N/T', 'alternative'))
When using addText('N/T', 'alternative')
, I am getting N/T
instead of the expected result alternative
. How can I modify my code to thoroughly check all situations and return the correct answer as shown in the example?