I have tried the following but it's throwing an exception:
if (!$get('sslot_hf0').value in ('X', 'Y', 'Z', '0')) {
$get('sslot_hf0').value = 'X';
}
I am looking for a function similar to the IN
operator in SQL
You can use indexOf
['X', 'Y', 'Z', '0'].indexOf('Z')
> 2
['X', 'Y', 'Z', '0'].indexOf('T')
> -1
if (['X', 'Y', 'Z', '0'].indexOf($get('sslot_hf0').value) !== -1) {
//...
}
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