The Goal: To get the first character in the input field and place it next to the input box. I’m trying to this for sorting purposes. jQuery datatables won’t work and I’m looking for an alternate solution. Possible Solution: Get the first char charAt(0) and place it next to the input field to make that column ‘sortable’. Desired Result: D
Tag: charat
How to avoid TypeError: Cannot read property ‘charAt’ of undefined when the json input is not available?
I have an avatar that shows the first letter of the user’s first name. The list of user name comes when the API call. If the API call not happened TypeError: Cannot read property ‘charAt’ of undefined error coming as there is no in put json. My react code as follows. Answer User can still be undefined and throw error.