I have an array that contains various strings:
var arr = ['1234','23C','456','356778', '56']
My goal is to filter out array elements that are less than 3 characters or more than 4 characters. The resulting array should only include elements with 3 or 4 characters, like so:
arr = ['1234', '23C', '456']; //only 3 and 4 character strings in the array
Additionally, I would like to modify the array further by removing the last digit from any element that has more than 3 characters. The final array should look like this:
arr = ['123', '23C', '456'];