I am trying to compare better logic variables in homeyscript. The reason is to find duplicate variables. My variables are called RadioDay1, RadioDay2 … RadioDay14.
The variables look like this http://192.168.178.2:5005/woonkamer/favorite/Deep House Ibiza
Or filled with the text No Radio Station
Or filled with the text Playlist1, Playlist2 or Playlist3
I compare the variables like this;
Var n = RadioDay1.localeCompare(RadioDay2)
When n = 0, there is a duplicate variable.
This works ok, but three of the variables have a different input. The input is instead of e.g http://192.168.178.2:5005/woonkamer/favorite/Deep House Ibiza filled with Playlist1, Playlist2 and Playlist3.
When i try this;
Var n = RadioDay1.localeCompare(RadioDay2)
If(n = 0 && RadioDay2 != ‘No Radio Station’ && RadioDay3. != ‘No RadioStation’ || RadioDay1.includes(‘Playlist’) === RadioDay3.includes(‘Playlist’))
It always find a duplicate. When i remove the part RadioDay1.includes(‘Playlist’) === RadioDay3.includes(‘Playlist’)) it works and only find real duplicates. So the problem occurs when i try to find variables with the content Playlist
Anyone a idea what i am doing wrong?