I have a dropdown box containing letters A through . The user can select a letter from the dropdown box and it will be shown on the screen if it was not already selected.
The logic for this is very simple and it is as follows:
– When a letter is selected, it is added to an array and then shown on the screen if it meets the following conditions
1 - It is not already in the array
2 - It is not equal to “All”
3 - It is not equal to ''Select" which is the default value of the dropdown box
I thought that a False followed by two Trues will result in a False and prevent the code inside the if block from being executed but it doesn’t seem to be the case. When the user selects a letter that had previously been selected, the code inside the if block should not execute, the selected letter should not be added to the array, and the letter should not be shown on screen but it appears my if conditions failed to prevent all that.
Please see my code in this jsfiddle