Is there a datatype in javaScript or PHP etc. that can contain just a view different custom values.
Like a boolean but with three types.
Like something like this:
the value must be one of the following things "above", "under" or "in the middle".
Hey in JavaScript there is no such thing, but you can use number and create some kind of enum like this
const ENUM = {
ABOVE: 1,
MIDDLE: 0,
UNDER: -1
}
and then use it like this:
function acceptValue(en) {
if (en === ENUM.ABOVE) {
/* do something */
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With