JSFiddle - React, Tailwind, and code Playground
JavaScript
function chooseOne(age) {
text = ''
if (age > 40) {
text += "age is 40ish, "
} else if (age > 30) {
text += "age is 30ish, "
} else if (age > 20) {
text += "age is 20ish, "
} else {
text = "other than that"
}
console.log("chooseOne returns", text)
}
function chooseMultiple(age) {
text = 'start check: '
if (age > 40) {
text += "age is more than 40, "
}
if (age > 30) {
text += "age is more than 30, "
}
if (age > 20) {
text += "age is more than 20, "
}
console.log("chooseMultiple returns", text)
}
chooseOne(31)
chooseMultiple(31)