{value && <Badge/>} renders Badge only for truthy values — but 0 leaks as text! For each input line (a JSON value), print what renders: Badge for truthy, (nothing) for false/null/""/undefined, or the leaked value for 0 and NaN.
Input: one JSON value per line. Output: one render result per line.
Your program reads from stdin and prints to stdout.
Example 1
Input: true 0 ""
Output: Badge 0 (nothing)
Hints
{value && <Badge/>} renders Badge only for truthy values — but 0 leaks as text! For each input line (a JSON value), print what renders: Badge for truthy, (nothing) for false/null/""/undefined, or the leaked value for 0 and NaN.
Input: one JSON value per line. Output: one render result per line.
Your program reads from stdin and prints to stdout.
Example 1
Input: true 0 ""
Output: Badge 0 (nothing)
Hints