<script> var arr = ["A1", "A2", "B5"]; arr = arr.filter(function(str) { return str.startsWith("A") }) document.write(arr) </script>