I have one country list array object sorted based on key value where keys are alphabets. I have one section of all alphabets list for navigation. Once user clicks on any alphabets letter content should scroll to that letter. Or if that key is not having value it should scroll to nearest key having value.
Ex: There are some keys like H,I,J,K,Q which doesn’t have value in country array.
So once I click on “I” keys it should scroll to nearest keys having value ie: G
How I can check and pick nearest key from an alphabet array which is having value once user selects any keys.