Completed 1.9 (unicafe step 4)

This commit is contained in:
2021-08-26 20:26:57 +07:00
parent 59be6fbdaa
commit b510a037b2
+12 -6
View File
@@ -13,15 +13,21 @@ const App = () => {
const avg = (all !== 0) ? (good - bad) / all : 0 const avg = (all !== 0) ? (good - bad) / all : 0
const positive = (all !== 0) ? good/all*100 : "NA" const positive = (all !== 0) ? good/all*100 : "NA"
return ( return (
<div> <div>
<h1>Statistic</h1> <h1>Statistic</h1>
<p>Good: {good}</p> {all > 0 &&
<p>Neutral: {neutral}</p> <div>
<p>Bad: {bad}</p> <p>Good: {good}</p>
<p>All: {all}</p> <p>Neutral: {neutral}</p>
<p>Average: {avg} </p> <p>Bad: {bad}</p>
<p>Positive: {positive} %</p> <p>All: {all}</p>
<p>Average: {avg} </p>
<p>Positive: {positive} %</p>
</div>
}
{all === 0 && "No feedback given"}
</div> </div>
) )
} }