1👍
✅
You’re running .includes
on the string "['en-ca', 'pt']"
, not the array ['en-ca', 'pt']
as you’re expecting. For a string, includes will match any substring, (see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes ), so that’s why it’s matching "en"
"en-ca"
"ca"
and "pt"
. Convert that string back into an array before calling .includes
and you’ll be golden!
Source:stackexchange.com