Searching for only certain characters of elements in an array

Question:
I would like to know if it is possible to search for elements in arrays within database fields that start with certain characters.

Product:
I am using Wix Editor.

What are you trying to achieve:
I have a field in a Wix database that contains arrays with names (e.g. [“Ann”, “John”] in one row, [“Albert”, “David”] in another, and so on). I would like to build a query that searches for rows where there are any names that begin with the letter “a”.

// Sample array
const array = ["apple", "banana", "apricot", "orange", "grape"];

// Function to filter elements that start with a certain prefix
function filterArrayByPrefix(arr, prefix) {
  return arr.filter(item => item.startsWith(prefix));
}

// Example usage
const filteredArray = filterArrayByPrefix(array, "ap");
console.log(filteredArray); // Output: ["apple", "apricot"]