How to creat a short version for this JS template

using

          if (state === '0' || state === '1' || state === '2' || state === '3' || state === '4'
              || state === '5' || state === '6' || state === '7' || state === '8' || state === '9')
          return 'mdi:numeric-' + state + '-box-multiple-outline';

can I write that like

          if (state in ['1','2',';3','4','5','6','7','8','9'])
          return 'mdi:numeric-' + state + '-box-multiple-outline';

like we can do in jinja templates? or is a better way available?
thanks for checking , or a pointer to docs to explain this to me.

var items = ['1','2','3','4','5','6','7','8','9'];
if (items.includes(state))
  return 'mdi:numeric-' + state + '-box-multiple-outline';
1 Like

thx Petro
appreciated! (though must admit Ive tested my own version, and it does seem to work…)
unless it is still in cache of course… which would be the reason to prefer your var items solution?