Hello Everyone! New to this forum and currently learning JS. While working on a Wordle clone, I had a small syntax doubt. In the below command, I am trying to store the element containing the data attribute ( data-key), regardless of the case of the variable letter being received.
First, querySelector takes a string as an argument, so you can’t use pattern matching here. Second, the string must be a valid CSS selector string. CSS doesn’t provide a method for doing pattern matching. If you want to select for both lower case and upper case then you will have to use two separate selectors: